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

Do not die in case of instance damaged XML.

parent 60ae55a9
...@@ -412,6 +412,7 @@ class SlapTool(BaseTool): ...@@ -412,6 +412,7 @@ class SlapTool(BaseTool):
def _instanceXmlToDict(self, xml): def _instanceXmlToDict(self, xml):
result_dict = {} result_dict = {}
try:
if xml is not None and xml != '': if xml is not None and xml != '':
tree = etree.fromstring(xml.encode('utf-8')) tree = etree.fromstring(xml.encode('utf-8'))
for element in tree.findall('parameter'): for element in tree.findall('parameter'):
...@@ -422,6 +423,9 @@ class SlapTool(BaseTool): ...@@ -422,6 +423,9 @@ class SlapTool(BaseTool):
else: else:
value = element.text value = element.text
result_dict[key] = value 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