get_one now also returns the name field, and modifying modules for get_one and added in some IDs in a handful of unit tests

This commit is contained in:
John Westcott IV
2020-09-04 15:41:36 -04:00
parent 4c4d6dad49
commit 106157c600
34 changed files with 83 additions and 99 deletions

View File

@@ -108,9 +108,8 @@ def main():
inventory_id = module.resolve_name_to_id('inventories', inventory)
# Attempt to look up the object based on the provided name and inventory ID
group = module.get_one('groups', **{
group, name = module.get_one('groups', name_or_id=name, **{
'data': {
'name': name,
'inventory': inventory_id
}
})
@@ -136,8 +135,8 @@ def main():
continue
id_list = []
for sub_name in name_list:
sub_obj = module.get_one(resource, **{
'data': {'inventory': inventory_id, 'name': sub_name}
sub_obj, sub_name = module.get_one(resource, name_or_id=sub_name, **{
'data': {'inventory': inventory_id},
})
if sub_obj is None:
module.fail_json(msg='Could not find {0} with name {1}'.format(resource, sub_name))