mirror of
https://github.com/ansible/awx.git
synced 2026-03-19 18:07:33 -02:30
Remove api version from hardcoded inventory url (#16039)
* update url endpoints * reformat line for length
This commit is contained in:
@@ -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))
|
'Invalid type for configuration option inventory_id, ' 'not integer, and cannot convert to string: {err}'.format(err=to_native(e))
|
||||||
), e)
|
), e)
|
||||||
inventory_id = inventory_id.replace('/', '')
|
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.
|
# To start with, create all the groups.
|
||||||
for group_name in inventory:
|
for group_name in inventory:
|
||||||
@@ -169,7 +170,7 @@ class InventoryModule(BaseInventoryPlugin):
|
|||||||
# Fetch extra variables if told to do so
|
# Fetch extra variables if told to do so
|
||||||
if self.get_option('include_metadata'):
|
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 = {}
|
||||||
server_data['license_type'] = config_data.get('license_info', {}).get('license_type', 'unknown')
|
server_data['license_type'] = config_data.get('license_info', {}).get('license_type', 'unknown')
|
||||||
|
|||||||
Reference in New Issue
Block a user