From 71fb55fb5da77e660fb34b92c2ddf93b0dc8cf3c Mon Sep 17 00:00:00 2001 From: Anders Harrisson <anders.harrisson@ess.eu> Date: Thu, 24 Oct 2024 14:45:47 +0200 Subject: [PATCH] Get AWX groups from the specific inventory JIRA INFRA-10813 --- netbox_awx_plugin/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/netbox_awx_plugin/models.py b/netbox_awx_plugin/models.py index f1f1da2..82567ab 100644 --- a/netbox_awx_plugin/models.py +++ b/netbox_awx_plugin/models.py @@ -89,7 +89,7 @@ class AWXInventory(NetBoxModel): def get_group(self, name): params = {"name": name} 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, headers=self.awx.get_headers(), verify=False, @@ -150,9 +150,9 @@ class AWXInventory(NetBoxModel): ) r.raise_for_status() - def get_host_groups(self, hostname): + def get_host_groups(self, host_id): 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(), verify=False, ) -- GitLab