mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Minidom fixups to prevent Exceptions
This commit is contained in:
parent
7b4fc2aa1e
commit
47fea1fc0b
@ -223,7 +223,7 @@ def get_nics(vm_):
|
|||||||
# driver, source, and match can all have optional attributes
|
# driver, source, and match can all have optional attributes
|
||||||
if re.match('(driver|source|address)', v_node.tagName):
|
if re.match('(driver|source|address)', v_node.tagName):
|
||||||
temp = {}
|
temp = {}
|
||||||
for key in v_node.attributes:
|
for key in v_node.attributes.keys():
|
||||||
temp[key] = v_node.getAttribute(key)
|
temp[key] = v_node.getAttribute(key)
|
||||||
nic[str(v_node.tagName)] = temp
|
nic[str(v_node.tagName)] = temp
|
||||||
# virtualport needs to be handled separately, to pick up the
|
# virtualport needs to be handled separately, to pick up the
|
||||||
@ -231,7 +231,7 @@ def get_nics(vm_):
|
|||||||
if v_node.tagName == "virtualport":
|
if v_node.tagName == "virtualport":
|
||||||
temp = {}
|
temp = {}
|
||||||
temp['type'] = v_node.getAttribute('type')
|
temp['type'] = v_node.getAttribute('type')
|
||||||
for key in v_node.attributes:
|
for key in v_node.attributes.keys():
|
||||||
temp[key] = v_node.getAttribute(key)
|
temp[key] = v_node.getAttribute(key)
|
||||||
nic['virtualport'] = temp
|
nic['virtualport'] = temp
|
||||||
if 'mac' not in nic:
|
if 'mac' not in nic:
|
||||||
@ -275,7 +275,7 @@ def get_graphics(vm_):
|
|||||||
for node in doc.getElementsByTagName("domain"):
|
for node in doc.getElementsByTagName("domain"):
|
||||||
g_nodes = node.getElementsByTagName("graphics")
|
g_nodes = node.getElementsByTagName("graphics")
|
||||||
for g_node in g_nodes:
|
for g_node in g_nodes:
|
||||||
for key in g_node.attributes:
|
for key in g_node.attributes.keys():
|
||||||
out[key] = g_node.getAttribute(key)
|
out[key] = g_node.getAttribute(key)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ def get_disks(vm_):
|
|||||||
target = targets[0]
|
target = targets[0]
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
if 'dev' in list(target.attributes) and 'file' in list(source.attributes):
|
if target.attributes.has_key('dev') and source.attributes.has_key('file'):
|
||||||
disks[target.getAttribute('dev')] = {
|
disks[target.getAttribute('dev')] = {
|
||||||
'file': source.getAttribute('file')}
|
'file': source.getAttribute('file')}
|
||||||
for dev in disks:
|
for dev in disks:
|
||||||
|
Loading…
Reference in New Issue
Block a user