Commit 554d35a1 authored by Łukasz Nowak's avatar Łukasz Nowak

slapos/slap: Stabilise connection_dict

connection_dict generated by client can be different in details from the
server side, especially it could be directly serialised to string like:

"{u'key': u'value', 'int': 1, 'empty': None}"

So pass it thorugh a way how it is treat on the server, so it would always be:

"{'key': 'value', 'int': '1', 'empty': ''}"
parent f6beaf95
...@@ -44,11 +44,10 @@ from functools import wraps ...@@ -44,11 +44,10 @@ from functools import wraps
import six import six
from .util import xml2dict
from .exception import ResourceNotReady, ServerError, NotFoundError, \ from .exception import ResourceNotReady, ServerError, NotFoundError, \
ConnectionError ConnectionError
from .hateoas import SlapHateoasNavigator, ConnectionHelper from .hateoas import SlapHateoasNavigator, ConnectionHelper
from slapos.util import loads, dumps, bytes2str from slapos.util import loads, dumps, bytes2str, xml2dict, dict2xml
from xml.sax import saxutils from xml.sax import saxutils
from zope.interface import implementer from zope.interface import implementer
...@@ -608,6 +607,8 @@ class ComputerPartition(SlapRequester): ...@@ -608,6 +607,8 @@ class ComputerPartition(SlapRequester):
return self._software_release_document return self._software_release_document
def setConnectionDict(self, connection_dict, slave_reference=None): def setConnectionDict(self, connection_dict, slave_reference=None):
# recreate connection_dict that it would became the same as on server
connection_dict = xml2dict(dict2xml(connection_dict))
if self.getConnectionParameterDict() == connection_dict: if self.getConnectionParameterDict() == connection_dict:
return return
......
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