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
|
||||
if re.match('(driver|source|address)', v_node.tagName):
|
||||
temp = {}
|
||||
for key in v_node.attributes:
|
||||
for key in v_node.attributes.keys():
|
||||
temp[key] = v_node.getAttribute(key)
|
||||
nic[str(v_node.tagName)] = temp
|
||||
# virtualport needs to be handled separately, to pick up the
|
||||
@ -231,7 +231,7 @@ def get_nics(vm_):
|
||||
if v_node.tagName == "virtualport":
|
||||
temp = {}
|
||||
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)
|
||||
nic['virtualport'] = temp
|
||||
if 'mac' not in nic:
|
||||
@ -275,7 +275,7 @@ def get_graphics(vm_):
|
||||
for node in doc.getElementsByTagName("domain"):
|
||||
g_nodes = node.getElementsByTagName("graphics")
|
||||
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)
|
||||
return out
|
||||
|
||||
@ -301,7 +301,7 @@ def get_disks(vm_):
|
||||
target = targets[0]
|
||||
else:
|
||||
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')] = {
|
||||
'file': source.getAttribute('file')}
|
||||
for dev in disks:
|
||||
|
Loading…
Reference in New Issue
Block a user