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.
pull/56093/head
Gonéri Le Bouder 6 years ago
parent ad2c7ec9d7
commit 223321e7e2

@ -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…
Cancel
Save