diff --git a/changelogs/fragments/vmware_datastore_facts.yaml b/changelogs/fragments/vmware_datastore_facts.yaml new file mode 100644 index 0000000000..66e6896d70 --- /dev/null +++ b/changelogs/fragments/vmware_datastore_facts.yaml @@ -0,0 +1,2 @@ +minor_changes: + - vmware_datastore_facts - When no datastore was found, returns an empty list. diff --git a/lib/ansible/modules/cloud/vmware/vmware_datastore_facts.py b/lib/ansible/modules/cloud/vmware/vmware_datastore_facts.py index 041b088294..816adffbb8 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_datastore_facts.py +++ b/lib/ansible/modules/cloud/vmware/vmware_datastore_facts.py @@ -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__':