mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 02:19:58 -03:30
Update the Insights API urls to use the new url structure
This commit is contained in:
parent
f01a936202
commit
af2484cd97
@ -1694,14 +1694,14 @@ class HostInsights(GenericAPIView):
|
||||
|
||||
(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)
|
||||
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.
|
||||
return Response(res[0], status=res[1])
|
||||
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)
|
||||
(msg, err_code) = self.get_insights(reports_url, username, password)
|
||||
return Response(msg, status=err_code)
|
||||
|
||||
@ -54,9 +54,7 @@ class ActionModule(ActionBase):
|
||||
license
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
url = '{}/r/insights/platform/remediations/v1/remediations?sort=-updated_at'.format(insights_url)
|
||||
url = '{}/api/remediations/v1/remediations?sort=-updated_at'.format(insights_url)
|
||||
|
||||
res = session.get(url, headers=headers, timeout=120)
|
||||
|
||||
@ -81,7 +79,7 @@ class ActionModule(ActionBase):
|
||||
return result
|
||||
|
||||
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'])
|
||||
res = session.get(url, timeout=120)
|
||||
if res.status_code != 200:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user