mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fixup the property collection for dictionaries vs. objects (#28609)
* Fixup the property collection for dictionaries vs. objects * Remove debug lines * Do not attempt to sort because it's a waste * Remove unused code * Remove extra code * Capture lowercase keys
This commit is contained in:
parent
11c9756d9c
commit
443b25d72a
1 changed files with 21 additions and 12 deletions
|
@ -578,6 +578,12 @@ class VMWareInventory(object):
|
|||
|
||||
for idx, x in enumerate(parts):
|
||||
|
||||
if isinstance(val, dict):
|
||||
if x in val:
|
||||
val = val.get(x)
|
||||
elif x.lower() in val:
|
||||
val = val.get(x.lower())
|
||||
else:
|
||||
# if the val wasn't set yet, get it from the parent
|
||||
if not val:
|
||||
try:
|
||||
|
@ -591,6 +597,9 @@ class VMWareInventory(object):
|
|||
except AttributeError as e:
|
||||
self.debugl(e)
|
||||
|
||||
# make sure it serializes
|
||||
val = self._process_object_types(val)
|
||||
|
||||
# lowercase keys if requested
|
||||
if self.lowerkeys:
|
||||
x = x.lower()
|
||||
|
@ -653,7 +662,7 @@ class VMWareInventory(object):
|
|||
|
||||
return rdata
|
||||
|
||||
def _process_object_types(self, vobj, thisvm=None, inkey=None, level=0):
|
||||
def _process_object_types(self, vobj, thisvm=None, inkey='', level=0):
|
||||
''' Serialize an object '''
|
||||
rdata = {}
|
||||
|
||||
|
|
Loading…
Reference in a new issue