summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Boggs <cboggs@users.noreply.github.com>2017-04-28 14:14:05 -0500
committerjctanner <tanner.jc@gmail.com>2017-04-28 15:14:05 -0400
commit1c11a35f70bc4aee40dfe1fdde7f151ea55eddc2 (patch)
tree67f235ba89872bfc2ea2db20a93053998dd4714c
parentf9ec06d1dcdef5675a3c4b190bee45d8132f3fa6 (diff)
downloadansible-1c11a35f70bc4aee40dfe1fdde7f151ea55eddc2.tar.gz
Fix orphan resource pool crash (Issue #24078) (#24079)
Fixes issue [#24078](https://github.com/ansible/ansible/issues/24078) Resource pools are retrieved from VSphere regardless of the state of the `resource_pool` parameter. During this process, each retrieved Resource Pool is checked for the `parent` attribute, and if it exists, the currently-scoped parent object is compared against the Resource Pool's parent object. The method doing the check, however, `assert`s that the parent object is not `None`. In some cases, a Resource Pool will have the `parent` attr, but that `parent` object will be `None`, causing the `assert` to fail. This should avoid that. :-)
-rw-r--r--lib/ansible/modules/cloud/vmware/vmware_guest.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ansible/modules/cloud/vmware/vmware_guest.py b/lib/ansible/modules/cloud/vmware/vmware_guest.py
index fca8ef98ae..3901fdb17c 100644
--- a/lib/ansible/modules/cloud/vmware/vmware_guest.py
+++ b/lib/ansible/modules/cloud/vmware/vmware_guest.py
@@ -1011,7 +1011,7 @@ class PyVmomiHelper(object):
if not rp[0]:
continue
- if not hasattr(rp[0], 'parent'):
+ if not hasattr(rp[0], 'parent') or not rp[0].parent:
continue
# Find resource pool on host