From 1afd23043dca8bb841a73dad40fdcadb27f69d76 Mon Sep 17 00:00:00 2001 From: jessicamack Date: Wed, 25 Jun 2025 22:53:03 +0200 Subject: [PATCH] Remove api version from hardcoded inventory url (#16039) (#6980) * update url endpoints * reformat line for length --- awx_collection/plugins/inventory/controller.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/awx_collection/plugins/inventory/controller.py b/awx_collection/plugins/inventory/controller.py index ee049c80fd..66dfe32b9b 100644 --- a/awx_collection/plugins/inventory/controller.py +++ b/awx_collection/plugins/inventory/controller.py @@ -134,9 +134,10 @@ class InventoryModule(BaseInventoryPlugin): 'Invalid type for configuration option inventory_id, ' 'not integer, and cannot convert to string: {err}'.format(err=to_native(e)) ), e) inventory_id = inventory_id.replace('/', '') - inventory_url = '/api/v2/inventories/{inv_id}/script/'.format(inv_id=inventory_id) - inventory = module.get_endpoint(inventory_url, data={'hostvars': '1', 'towervars': '1', 'all': '1'})['json'] + inventory = module.get_endpoint( + 'inventories/{inv_id}/script/'.format(inv_id=inventory_id), data={'hostvars': '1', 'towervars': '1', 'all': '1'} + )['json'] # To start with, create all the groups. for group_name in inventory: @@ -169,7 +170,7 @@ class InventoryModule(BaseInventoryPlugin): # Fetch extra variables if told to do so if self.get_option('include_metadata'): - config_data = module.get_endpoint('/api/v2/config/')['json'] + config_data = module.get_endpoint('config/')['json'] server_data = {} server_data['license_type'] = config_data.get('license_info', {}).get('license_type', 'unknown')