Skip to content
Snippets Groups Projects
Commit 71fb55fb authored by Anders Harrisson's avatar Anders Harrisson
Browse files

Get AWX groups from the specific inventory

JIRA INFRA-10813
parent 9032d6e0
No related branches found
Tags v0.1.1
No related merge requests found
...@@ -89,7 +89,7 @@ class AWXInventory(NetBoxModel): ...@@ -89,7 +89,7 @@ class AWXInventory(NetBoxModel):
def get_group(self, name): def get_group(self, name):
params = {"name": name} params = {"name": name}
r = requests.get( r = requests.get(
url=urljoin(self.awx.url, "/api/v2/groups/"), url=urljoin(self.awx.url, "/api/v2/inventories/{}/groups/".format(self.inventory_id)),
params=params, params=params,
headers=self.awx.get_headers(), headers=self.awx.get_headers(),
verify=False, verify=False,
...@@ -150,9 +150,9 @@ class AWXInventory(NetBoxModel): ...@@ -150,9 +150,9 @@ class AWXInventory(NetBoxModel):
) )
r.raise_for_status() r.raise_for_status()
def get_host_groups(self, hostname): def get_host_groups(self, host_id):
r = requests.get( r = requests.get(
url=urljoin(self.awx.url, "/api/v2/hosts/{}/groups/".format(hostname)), url=urljoin(self.awx.url, "/api/v2/hosts/{}/groups/".format(host_id)),
headers=self.awx.get_headers(), headers=self.awx.get_headers(),
verify=False, verify=False,
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment