Commit 714a191f authored by Łukasz Nowak's avatar Łukasz Nowak

Do not die in case of instance damaged XML.

parent 60ae55a9
...@@ -412,16 +412,20 @@ class SlapTool(BaseTool): ...@@ -412,16 +412,20 @@ class SlapTool(BaseTool):
def _instanceXmlToDict(self, xml): def _instanceXmlToDict(self, xml):
result_dict = {} result_dict = {}
if xml is not None and xml != '': try:
tree = etree.fromstring(xml.encode('utf-8')) if xml is not None and xml != '':
for element in tree.findall('parameter'): tree = etree.fromstring(xml.encode('utf-8'))
key = element.get('id') for element in tree.findall('parameter'):
value = result_dict.get(key, None) key = element.get('id')
if value is not None: value = result_dict.get(key, None)
value = value + ' ' + element.text if value is not None:
else: value = value + ' ' + element.text
value = element.text else:
result_dict[key] = value value = element.text
result_dict[key] = value
except (etree.XMLSchemaError, etree.XMLSchemaParseError,
etree.XMLSchemaValidateError, etree.XMLSyntaxError):
LOG('SlapTool', INFO, 'Issue during parsing xml:', error=True)
return result_dict return result_dict
def _getSlapPartitionByPackingList(self, computer_partition_document): def _getSlapPartitionByPackingList(self, computer_partition_document):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment