Skip to content

Commit

Permalink
Set this CM API version: v30
Browse files Browse the repository at this point in the history
  • Loading branch information
roczei committed Oct 28, 2020
1 parent adadf3a commit 208560c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions dynamic_inventory_cm_py2
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ClouderaManagerInventory:
self.inventory = {"_meta" : { "hostvars": {} }}
self.cookie_path = os.environ["HOME"] + os.sep + ".cm" + os.sep + ".cm_cookie"
self.json_path = os.environ["HOME"] + os.sep + ".cm" + os.sep + ".cm_inventory.json"
self.api_version = ""
self.api_version = "v30"

cache_time_sec = os.getenv("CM_CACHE_TIME_SEC")
disable_ca_check = os.getenv("CM_DISABLE_CA_CHECK")
Expand Down Expand Up @@ -162,8 +162,8 @@ class ClouderaManagerInventory:
version_request = urllib2.Request(version_url, None, headers)
version_response = urllib2.urlopen(version_request, timeout = self.timeout_sec).read()

if version_response:
self.api_version = version_response
#if version_response:
# self.api_version = version_response

hosts_url = url + "/api/" + self.api_version + "/hosts"
hosts_response = opener.open(hosts_url, timeout = self.timeout_sec).read()
Expand Down
6 changes: 3 additions & 3 deletions dynamic_inventory_cm_py3
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ClouderaManagerInventory:
self.inventory = {"_meta" : { "hostvars": {} }}
self.cookie_path = os.environ["HOME"] + os.sep + ".cm" + os.sep + ".cm_cookie"
self.json_path = os.environ["HOME"] + os.sep + ".cm" + os.sep + ".cm_inventory.json"
self.api_version = ""
self.api_version = "v30"

cache_time_sec = os.getenv("CM_CACHE_TIME_SEC")
disable_ca_check = os.getenv("CM_DISABLE_CA_CHECK")
Expand Down Expand Up @@ -163,8 +163,8 @@ class ClouderaManagerInventory:
version_request = urllib.request.Request(version_url, None, headers)
version_response = urllib.request.urlopen(version_request, timeout = self.timeout_sec).read()

if version_response:
self.api_version = version_response.decode()
#if version_response:
# self.api_version = version_response.decode()

hosts_url = url + "/api/" + self.api_version + "/hosts"
hosts_response = opener.open(hosts_url, timeout = self.timeout_sec).read()
Expand Down

0 comments on commit 208560c

Please sign in to comment.