From af2484cd97e3ea8670f5a673fcddf02f689b278f Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Thu, 28 Mar 2019 11:26:39 -0400 Subject: [PATCH] Update the Insights API urls to use the new url structure --- awx/api/views/__init__.py | 4 ++-- awx/playbooks/action_plugins/insights.py | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/awx/api/views/__init__.py b/awx/api/views/__init__.py index 7e564082bf..9068629a5e 100644 --- a/awx/api/views/__init__.py +++ b/awx/api/views/__init__.py @@ -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) diff --git a/awx/playbooks/action_plugins/insights.py b/awx/playbooks/action_plugins/insights.py index 26fd4cd754..5cb19b45cf 100644 --- a/awx/playbooks/action_plugins/insights.py +++ b/awx/playbooks/action_plugins/insights.py @@ -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: