diff options
author | Alan Rominger <arominge@redhat.com> | 2023-05-15 19:48:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-15 19:48:59 +0200 |
commit | 0d5c0bcb91268445812cc70805d32a059106edda (patch) | |
tree | ac1afc989d449580f19c36d8c97ac65288932101 /awxkit | |
parent | [wsrelay] Handle heartbeet shutdown and redis drop (#13991) (diff) | |
download | awx-0d5c0bcb91268445812cc70805d32a059106edda.tar.xz awx-0d5c0bcb91268445812cc70805d32a059106edda.zip |
Skip constructed_inventory in a more correct loop (#14004)
Diffstat (limited to 'awxkit')
-rw-r--r-- | awxkit/awxkit/api/pages/api.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/awxkit/awxkit/api/pages/api.py b/awxkit/awxkit/api/pages/api.py index 8ba64254ae..01d1878387 100644 --- a/awxkit/awxkit/api/pages/api.py +++ b/awxkit/awxkit/api/pages/api.py @@ -253,7 +253,13 @@ class ApiV2(base.Base): # Import methods def _dependent_resources(self): - page_resource = {getattr(self, resource)._create().__item_class__: resource for resource in self.json} + page_resource = {} + for resource in self.json: + # The /api/v2/constructed_inventories endpoint is for the UI but will register as an Inventory endpoint + # We want to map the type to /api/v2/inventories/ which works for constructed too + if resource == 'constructed_inventory': + continue + page_resource[getattr(self, resource)._create().__item_class__] = resource data_pages = [getattr(self, resource)._create().__item_class__ for resource in EXPORTABLE_RESOURCES] for page_cls in itertools.chain(*has_create.page_creation_order(*data_pages)): @@ -404,10 +410,6 @@ class ApiV2(base.Base): for resource in self._dependent_resources(): endpoint = getattr(self, resource) - # The /api/v2/constructed_inventories endpoint is for the UI but will register as an Inventory endpoint causing import issues, so skip it - if endpoint == '/api/v2/constructed_inventories/': - log.debug("Ignoring /api/v2/constructed_inventories/ endpoint.") - continue # Load up existing objects, so that we can try to update or link to them self._cache.get_page(endpoint) |