Pull in functionality from lookup plugin get_id into tower_api itself

This commit is contained in:
AlanCoding
2020-06-18 12:44:39 -04:00
committed by John Westcott IV
parent f4454a6c93
commit 30ff112c87
3 changed files with 129 additions and 34 deletions

View File

@@ -274,10 +274,7 @@ class TowerModule(AnsibleModule):
def get_all_endpoint(self, endpoint, *args, **kwargs):
response = self.get_endpoint(endpoint, *args, **kwargs)
if 'next' not in response['json']:
if not 'none_is_not_fatal' in kwargs or not kwargs['none_is_not_fatal']:
raise RuntimeError('Expected list from API at {0}, got: {1}'.format(endpoint, response))
else:
return response
raise RuntimeError('Expected list from API at {0}, got: {1}'.format(endpoint, response))
next_page = response['json']['next']
if response['json']['count'] > 10000: