mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-30 12:10:22 -07:00
VMware: Check if cluster exists or not (#38517)
This fix adds a check if Datacenter contains cluster but does not have ESXi server associated with that cluster. Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
efc3f4f824
commit
93fbfbe4cf
1 changed files with 2 additions and 0 deletions
|
@ -1722,6 +1722,8 @@ class PyVmomiHelper(PyVmomi):
|
||||||
# next priority, cluster given, take the root of the pool
|
# next priority, cluster given, take the root of the pool
|
||||||
elif self.params['cluster']:
|
elif self.params['cluster']:
|
||||||
cluster = self.cache.get_cluster(self.params['cluster'])
|
cluster = self.cache.get_cluster(self.params['cluster'])
|
||||||
|
if cluster is None:
|
||||||
|
self.module.fail_json(msg="Unable to find cluster '%(cluster)s'" % self.params)
|
||||||
resource_pool = cluster.resourcePool
|
resource_pool = cluster.resourcePool
|
||||||
# fallback, pick any RP
|
# fallback, pick any RP
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue