Commit 6d2c5888 authored by Xavier Thompson's avatar Xavier Thompson

slap/slap: Unwrap json-in-xml

This makes it so that both `xml` and `json-in-xml` encoding for
instance parameters are accepted by all SRs, regardless of whether
they use `slapos.cookbook:slapconfiguration` in `.serialised` mode.
parent a244d797
......@@ -548,9 +548,15 @@ class ComputerPartition(SlapRequester):
setattr(software_instance, '_%s' % key, value)
if raw_information["data"].get("text_content", None) is not None:
setattr(software_instance, '_parameter_dict', xml2dict(raw_information["data"]['text_content']))
parameter_dict = xml2dict(raw_information["data"]['text_content'])
if len(parameter_dict) == 1:
try:
parameter_dict = json.loads(parameter_dict['_'])
except (KeyError, ValueError, TypeError):
pass
else:
setattr(software_instance, '_parameter_dict', {})
parameter_dict = {}
setattr(software_instance, '_parameter_dict', parameter_dict)
setattr(software_instance, '_requested_state', raw_information["data"]['slap_state'])
setattr(software_instance, '_connection_dict', raw_information["data"]['connection_parameter_list'])
......
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