Skip to content

Commit 1330a1b

Browse files
authored
Remove api version from hardcoded inventory url (#16039)
* update url endpoints * reformat line for length
1 parent 022314b commit 1330a1b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

awx_collection/plugins/inventory/controller.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,10 @@ def parse(self, inventory, loader, path, cache=True):
134134
'Invalid type for configuration option inventory_id, ' 'not integer, and cannot convert to string: {err}'.format(err=to_native(e))
135135
), e)
136136
inventory_id = inventory_id.replace('/', '')
137-
inventory_url = '/api/v2/inventories/{inv_id}/script/'.format(inv_id=inventory_id)
138137

139-
inventory = module.get_endpoint(inventory_url, data={'hostvars': '1', 'towervars': '1', 'all': '1'})['json']
138+
inventory = module.get_endpoint(
139+
'inventories/{inv_id}/script/'.format(inv_id=inventory_id), data={'hostvars': '1', 'towervars': '1', 'all': '1'}
140+
)['json']
140141

141142
# To start with, create all the groups.
142143
for group_name in inventory:
@@ -169,7 +170,7 @@ def parse(self, inventory, loader, path, cache=True):
169170
# Fetch extra variables if told to do so
170171
if self.get_option('include_metadata'):
171172

172-
config_data = module.get_endpoint('/api/v2/config/')['json']
173+
config_data = module.get_endpoint('config/')['json']
173174

174175
server_data = {}
175176
server_data['license_type'] = config_data.get('license_info', {}).get('license_type', 'unknown')

0 commit comments

Comments
 (0)