Use urn map for attribute resolution from top-level names
pyvmomi objects can be resolved by the vmodl name, e.g. "vim.vm.RelocateSpec" or by the wsdl name, e.g. "vim.VirtualMachineRelocateSpec". The wsdl name resolution uses "vim" as a hard-coded name, and doesn't resolve more wsdl namespaces like "sms" and "pbm"
This commit is contained in:
@@ -78,6 +78,9 @@ _wsdlDefMap = {}
|
|||||||
# if a.b.c and a.b.d are the nested classes of a.b, then _dependencyMap[a.b] = {c,d}
|
# if a.b.c and a.b.d are the nested classes of a.b, then _dependencyMap[a.b] = {c,d}
|
||||||
_dependencyMap = {}
|
_dependencyMap = {}
|
||||||
|
|
||||||
|
# Map top level names to xml namespaces
|
||||||
|
_urnMap = {"vim": XMLNS_VMODL_BASE, "sms": "urn:sms", "pbm": "urn:pbm"}
|
||||||
|
|
||||||
## Update the dependency map
|
## Update the dependency map
|
||||||
# Note: Must be holding the _lazyLock
|
# Note: Must be holding the _lazyLock
|
||||||
#
|
#
|
||||||
@@ -250,9 +253,9 @@ class LazyModule(object):
|
|||||||
else:
|
else:
|
||||||
if _CheckForDependency(self.name, attr):
|
if _CheckForDependency(self.name, attr):
|
||||||
typeObj = LazyModule(name)
|
typeObj = LazyModule(name)
|
||||||
elif self.name == "vim":
|
elif self.name in _urnMap:
|
||||||
try:
|
try:
|
||||||
typeObj = GetWsdlType(XMLNS_VMODL_BASE, attr)
|
typeObj = GetWsdlType(_urnMap[self.name], attr)
|
||||||
except:
|
except:
|
||||||
raise AttributeError(attr)
|
raise AttributeError(attr)
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user