mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 20:31:27 -07:00
VMware: handle special characters in datacenter name (#42922)
This fix handles special characters in VMware objects Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
7dd5f4c01c
commit
aefe963483
2 changed files with 3 additions and 3 deletions
|
@ -90,7 +90,7 @@ def find_obj(content, vimtype, name, first=True):
|
||||||
# Select the first match
|
# Select the first match
|
||||||
if first is True:
|
if first is True:
|
||||||
for obj in obj_list:
|
for obj in obj_list:
|
||||||
if obj.name == name:
|
if to_text(obj.name) == to_text(name):
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
# If no object found, return None
|
# If no object found, return None
|
||||||
|
|
|
@ -710,11 +710,11 @@ class PyVmomiCache(object):
|
||||||
""" Wrapper around find_obj to set datacenter context """
|
""" Wrapper around find_obj to set datacenter context """
|
||||||
result = find_obj(content, types, name)
|
result = find_obj(content, types, name)
|
||||||
if result and confine_to_datacenter:
|
if result and confine_to_datacenter:
|
||||||
if self.get_parent_datacenter(result).name != self.dc_name:
|
if to_text(self.get_parent_datacenter(result).name) != to_text(self.dc_name):
|
||||||
result = None
|
result = None
|
||||||
objects = self.get_all_objs(content, types, confine_to_datacenter=True)
|
objects = self.get_all_objs(content, types, confine_to_datacenter=True)
|
||||||
for obj in objects:
|
for obj in objects:
|
||||||
if name is None or obj.name == name:
|
if name is None or to_text(obj.name) == to_text(name):
|
||||||
return obj
|
return obj
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue