mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-13 12:39:10 -07:00
VMware: vmware_datastore_maintenancemode: check params (#56515)
Check the `datastore` parameter and raise an error if nothing has been found.
This commit is contained in:
parent
4b39748d21
commit
a4f08617d4
2 changed files with 6 additions and 1 deletions
|
@ -120,7 +120,10 @@ class VmwareDatastoreMaintenanceMgr(PyVmomi):
|
|||
datastore_cluster = self.params.get('datastore_cluster')
|
||||
self.datastore_objs = []
|
||||
if datastore_name:
|
||||
self.datastore_objs = [self.find_datastore_by_name(datastore_name=datastore_name)]
|
||||
ds = self.find_datastore_by_name(datastore_name=datastore_name)
|
||||
if not ds:
|
||||
self.module.fail_json(msg='Failed to find datastore "%(datastore)s".' % self.params)
|
||||
self.datastore_objs = [ds]
|
||||
elif cluster_name:
|
||||
cluster = find_cluster_by_name(self.content, cluster_name)
|
||||
if not cluster:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue