From 10cfac2f0e4a5ba9ed98f398e9202164f0bd6c77 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Thu, 11 Apr 2019 14:38:37 -0400 Subject: [PATCH] Update the error message when we can't discover the platform ID --- awx/api/views/__init__.py | 4 +++- awx/main/tests/functional/api/test_host_insights.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/awx/api/views/__init__.py b/awx/api/views/__init__.py index 699bba17d9..5b2114153f 100644 --- a/awx/api/views/__init__.py +++ b/awx/api/views/__init__.py @@ -1683,7 +1683,9 @@ class HostInsights(GenericAPIView): try: platform_id = res['results'][0]['id'] except (IndexError, KeyError): - raise NotFound(_('This host is not recognized as an Insights host.')) + raise NotFound( + _('Could not translate Insights system ID {}' + ' into an Insights platform ID.').format(host.insights_system_id)) return platform_id diff --git a/awx/main/tests/functional/api/test_host_insights.py b/awx/main/tests/functional/api/test_host_insights.py index 4daddf9dfa..d22471406f 100644 --- a/awx/main/tests/functional/api/test_host_insights.py +++ b/awx/main/tests/functional/api/test_host_insights.py @@ -38,7 +38,9 @@ class TestHostInsights: url = reverse('api:host_insights', kwargs={'pk': host.pk}) response = get(url, user('admin', True)) - assert response.data['error'] == 'This host is not recognized as an Insights host.' + assert response.data['error'] == ( + 'Could not translate Insights system ID 123e4567-e89b-12d3-a456-426655440000' + ' into an Insights platform ID.') assert response.status_code == 404 def test_insights_no_credential(self, get, hosts, user, mocker):