Merge pull request #8397 from john-westcott-iv/inv_src_get_one_fix

Fixing get_one calls in tower_inventory_source_update

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2020-10-15 21:33:19 +00:00 committed by GitHub
commit 59b5104431
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,17 +107,16 @@ def main():
interval = module.params.get('interval')
timeout = module.params.get('timeout')
lookup_data = {'name': inventory}
lookup_data = {}
if organization:
lookup_data['organization'] = module.resolve_name_to_id('organizations', organization)
inventory_object = module.get_one('inventories', data=lookup_data)
inventory_object = module.get_one('inventories', name_or_id=inventory, data=lookup_data)
if not inventory_object:
module.fail_json(msg='The specified inventory, {0}, was not found.'.format(lookup_data))
inventory_source_object = module.get_one('inventory_sources', **{
inventory_source_object = module.get_one('inventory_sources', name_or_id=inventory_source, **{
'data': {
'name': inventory_source,
'inventory': inventory_object['id'],
}
})