vmware_datastore_facts: empty list if none found
When `vmware_datastore_facts` does not fine any datastore, it raises an error. This is not consistent with the other _facts modules. It should just return an empty list instead.
This commit is contained in:
parent
ad2c7ec9d7
commit
223321e7e2
2 changed files with 3 additions and 9 deletions
2
changelogs/fragments/vmware_datastore_facts.yaml
Normal file
2
changelogs/fragments/vmware_datastore_facts.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- vmware_datastore_facts - When no datastore was found, returns an empty list.
|
|
@ -277,15 +277,7 @@ def main():
|
|||
|
||||
result['datastores'] = datastores
|
||||
|
||||
# found a datastore
|
||||
if datastores:
|
||||
module.exit_json(**result)
|
||||
else:
|
||||
msg = "Unable to gather datastore facts"
|
||||
if module.params['name']:
|
||||
msg += " for %(name)s" % module.params
|
||||
msg += " in datacenter %(datacenter)s" % module.params
|
||||
module.fail_json(msg=msg)
|
||||
module.exit_json(**result)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in a new issue