From 1c11a35f70bc4aee40dfe1fdde7f151ea55eddc2 Mon Sep 17 00:00:00 2001 From: Cody Boggs Date: Fri, 28 Apr 2017 14:14:05 -0500 Subject: [PATCH] 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. :-) --- lib/ansible/modules/cloud/vmware/vmware_guest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/vmware/vmware_guest.py b/lib/ansible/modules/cloud/vmware/vmware_guest.py index fca8ef98ae7..3901fdb17c3 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