mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00: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:
committed by
ansibot
parent
efc3f4f824
commit
93fbfbe4cf
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user