Skip to content

Commit

Permalink
Reformatted the code logic to set Path based on Splunk Version
Browse files Browse the repository at this point in the history
  • Loading branch information
ashah-splunk committed Jun 16, 2022
1 parent cd54110 commit bccd01a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions splunklib/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2721,10 +2721,11 @@ class Job(Entity):
def __init__(self, service, sid, **kwargs):
# Default to v2 in Splunk Version 9+
path = "{path}{sid}"
path = path.format(path=PATH_JOBS_V2, sid=sid)
# Fallback to v1 if Splunk Version < 9
# Formatting path based on the Splunk Version
if service.splunk_version < (9,):
path = path.format(path=PATH_JOBS, sid=sid)
else:
path = path.format(path=PATH_JOBS_V2, sid=sid)

Entity.__init__(self, service, path, skip_refresh=True, **kwargs)
self.sid = sid
Expand Down

0 comments on commit bccd01a

Please sign in to comment.