diff --git a/plugins/module_utils/vmware.py b/plugins/module_utils/vmware.py index 7e4c5063..058cd8a6 100644 --- a/plugins/module_utils/vmware.py +++ b/plugins/module_utils/vmware.py @@ -327,7 +327,7 @@ def get_vm_using_params( ) vms = [_vm] if _vm else None else: - vms = self.get_objs_by_name_or_moid([vim.VirtualMachine], _search_value) + vms = self.get_objs_by_name_or_moid([vim.VirtualMachine], _search_value, return_all=True) if vms and _search_type == 'name' and self.params.get(name_match_param): if self.params.get(name_match_param) == 'first': @@ -352,7 +352,7 @@ def get_folder_by_name(self, folder_name, fail_on_missing=False): Returns: list(folder object) or None """ - folder = self.get_objs_by_name_or_moid([vim.Folder], folder_name) + folder = self.get_objs_by_name_or_moid([vim.Folder], folder_name, return_all=True) if not folder and fail_on_missing: self.module.fail_json("Unable to find folder with name %s" % folder_name) return folder @@ -384,7 +384,7 @@ def get_datastore_by_name(self, ds_name, fail_on_missing=False): Returns: datastore object or None """ - ds = self.get_objs_by_name_or_moid([vim.Datastore], ds_name, first_only=True) + ds = self.get_objs_by_name_or_moid([vim.Datastore], ds_name) if not ds and fail_on_missing: self.module.fail_json("Unable to find datastore with name %s" % ds_name) return ds @@ -399,7 +399,7 @@ def get_resource_pool_by_name(self, pool_name, fail_on_missing=False): Returns: resource pool object or None """ - pool = self.get_objs_by_name_or_moid([vim.ResourcePool], pool_name, first_only=True) + pool = self.get_objs_by_name_or_moid([vim.ResourcePool], pool_name) if not pool and fail_on_missing: self.module.fail_json("Unable to find resource pool with name %s" % pool_name) return pool