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:
Gonéri Le Bouder 2019-04-04 13:14:58 -04:00
parent ad2c7ec9d7
commit 223321e7e2
2 changed files with 3 additions and 9 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- vmware_datastore_facts - When no datastore was found, returns an empty list.

View file

@ -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__':