mirror of
https://github.com/ansible/awx.git
synced 2026-03-06 11:11:07 -03:30
Update the Insights API urls to use the new url structure
This commit is contained in:
@@ -1694,14 +1694,14 @@ class HostInsights(GenericAPIView):
|
|||||||
|
|
||||||
(username, password) = self._extract_insights_creds(cred)
|
(username, password) = self._extract_insights_creds(cred)
|
||||||
|
|
||||||
host_url = '{}/r/insights/platform/inventory/api/v1/hosts?insights_id={}'.format(
|
host_url = '{}/api/inventory/v1/hosts?insights_id={}'.format(
|
||||||
settings.INSIGHTS_URL_BASE, host.insights_system_id)
|
settings.INSIGHTS_URL_BASE, host.insights_system_id)
|
||||||
res = self._call_insights_api(host_url, username, password)
|
res = self._call_insights_api(host_url, username, password)
|
||||||
if isinstance(res, tuple): # This value was constructed based on a bad response from the API.
|
if isinstance(res, tuple): # This value was constructed based on a bad response from the API.
|
||||||
return Response(res[0], status=res[1])
|
return Response(res[0], status=res[1])
|
||||||
platform_id = res.json()['results'][0]['id']
|
platform_id = res.json()['results'][0]['id']
|
||||||
|
|
||||||
reports_url = '{}/r/insights/platform/advisor/v1/system/{}/reports/'.format(
|
reports_url = '{}/api/insights/v1/system/{}/reports/'.format(
|
||||||
settings.INSIGHTS_URL_BASE, platform_id)
|
settings.INSIGHTS_URL_BASE, platform_id)
|
||||||
(msg, err_code) = self.get_insights(reports_url, username, password)
|
(msg, err_code) = self.get_insights(reports_url, username, password)
|
||||||
return Response(msg, status=err_code)
|
return Response(msg, status=err_code)
|
||||||
|
|||||||
@@ -54,9 +54,7 @@ class ActionModule(ActionBase):
|
|||||||
license
|
license
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
url = '{}/api/remediations/v1/remediations?sort=-updated_at'.format(insights_url)
|
||||||
|
|
||||||
url = '{}/r/insights/platform/remediations/v1/remediations?sort=-updated_at'.format(insights_url)
|
|
||||||
|
|
||||||
res = session.get(url, headers=headers, timeout=120)
|
res = session.get(url, headers=headers, timeout=120)
|
||||||
|
|
||||||
@@ -81,7 +79,7 @@ class ActionModule(ActionBase):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
for item in res.json()['remediations']:
|
for item in res.json()['remediations']:
|
||||||
url = '{}/r/insights/platform/remediations/v1/remediations/{}/playbook'.format(
|
url = '{}/api/remediations/v1/remediations/{}/playbook'.format(
|
||||||
insights_url, item['id'])
|
insights_url, item['id'])
|
||||||
res = session.get(url, timeout=120)
|
res = session.get(url, timeout=120)
|
||||||
if res.status_code != 200:
|
if res.status_code != 200:
|
||||||
|
|||||||
Reference in New Issue
Block a user