Commit 12efac17 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_cloud: Minor improvements

parent 52696697
......@@ -71,12 +71,9 @@ class SoftwareInstance(Item):
def _getXmlAsDict(self, xml):
result_dict = {}
if xml is None or xml == '':
return result_dict
if xml:
tree = etree.fromstring(xml)
for element in tree.findall('parameter'):
for element in tree.iterfind('parameter'):
key = element.get('id').encode("UTF-8")
value = result_dict.get(key, None)
if value is not None:
......@@ -160,6 +157,8 @@ class SoftwareInstance(Item):
def _asParameterDict(self, shared_instance_sql_list=None):
portal = self.getPortalObject()
compute_partition = self.getAggregateValue(portal_type="Compute Partition")
if compute_partition is None:
raise ValueError("Instance isn't allocated to call _asParamterDict")
timestamp = int(compute_partition.getModificationDate())
newtimestamp = int(self.getBangTimestamp(int(self.getModificationDate())))
......
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