Commit 22c7a6fe authored by Rafael Monnerat's avatar Rafael Monnerat

Do not post same connection parameters of slaves.

parent b992c34e
......@@ -1223,6 +1223,8 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
<string>slave_instance_list</string>
<list id='i9'>
<dictionary id='i10'>
<string>connection-parameter-key-list</string>
<list id='i11'/>
<unicode>paramé</unicode>
<unicode>%(slave_1_param)s</unicode>
<string>slap_software_type</string>
......@@ -1245,16 +1247,16 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
<string>_requested_state</string>
<string>started</string>
<string>_software_release_document</string>
<object id='i11' module='slapos.slap.slap' class='SoftwareRelease'>
<object id='i12' module='slapos.slap.slap' class='SoftwareRelease'>
<tuple>
<unicode>%(software_release_url)s</unicode>
<unicode>%(computer_id)s</unicode>
</tuple>
<dictionary id='i12'>
<dictionary id='i13'>
<string>_computer_guid</string>
<unicode>%(computer_id)s</unicode>
<string>_software_instance_list</string>
<list id='i13'/>
<list id='i14'/>
<string>_software_release</string>
<unicode>%(software_release_url)s</unicode>
</dictionary>
......@@ -2316,6 +2318,8 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
<string>slave_instance_list</string>
<list id='i9'>
<dictionary id='i10'>
<string>connection-parameter-key-list</string>
<list id='i11'/>
<unicode>paramé</unicode>
<unicode>%(slave_1_param)s</unicode>
<string>slap_software_type</string>
......@@ -2338,16 +2342,16 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
<string>_requested_state</string>
<string>started</string>
<string>_software_release_document</string>
<object id='i11' module='slapos.slap.slap' class='SoftwareRelease'>
<object id='i12' module='slapos.slap.slap' class='SoftwareRelease'>
<tuple>
<unicode>%(software_release_url)s</unicode>
<unicode>%(computer_id)s</unicode>
</tuple>
<dictionary id='i12'>
<dictionary id='i13'>
<string>_computer_guid</string>
<unicode>%(computer_id)s</unicode>
<string>_software_instance_list</string>
<list id='i13'/>
<list id='i14'/>
<string>_software_release</string>
<unicode>%(software_release_url)s</unicode>
</dictionary>
......
......@@ -51,19 +51,19 @@
<string>W:517, 13: Use of eval (eval-used)</string>
<string>W:568, 13: Use of eval (eval-used)</string>
<string>W:793, 13: Use of eval (eval-used)</string>
<string>W:1399, 13: Use of eval (eval-used)</string>
<string>W:1512, 13: Use of eval (eval-used)</string>
<string>W:1566, 13: Use of eval (eval-used)</string>
<string>W:1606, 13: Use of eval (eval-used)</string>
<string>W:2013, 2: Arguments number differs from overridden \'afterSetUp\' method (arguments-differ)</string>
<string>W:2109, 13: Use of eval (eval-used)</string>
<string>W:2492, 13: Use of eval (eval-used)</string>
<string>W:2546, 13: Use of eval (eval-used)</string>
<string>W:2573, 13: Use of eval (eval-used)</string>
<string>W:2728, 13: Use of eval (eval-used)</string>
<string>W:2756, 13: Use of eval (eval-used)</string>
<string>W:2805, 13: Use of eval (eval-used)</string>
<string>W:2852, 13: Use of eval (eval-used)</string>
<string>W:1401, 13: Use of eval (eval-used)</string>
<string>W:1514, 13: Use of eval (eval-used)</string>
<string>W:1568, 13: Use of eval (eval-used)</string>
<string>W:1608, 13: Use of eval (eval-used)</string>
<string>W:2015, 2: Arguments number differs from overridden \'afterSetUp\' method (arguments-differ)</string>
<string>W:2111, 13: Use of eval (eval-used)</string>
<string>W:2496, 13: Use of eval (eval-used)</string>
<string>W:2550, 13: Use of eval (eval-used)</string>
<string>W:2577, 13: Use of eval (eval-used)</string>
<string>W:2732, 13: Use of eval (eval-used)</string>
<string>W:2760, 13: Use of eval (eval-used)</string>
<string>W:2809, 13: Use of eval (eval-used)</string>
<string>W:2856, 13: Use of eval (eval-used)</string>
</tuple>
</value>
</item>
......
......@@ -826,12 +826,16 @@ class SlapTool(BaseTool):
slap_partition._instance_guid = parameter_dict.pop('instance_guid')
for slave_instance_dict in parameter_dict.get("slave_instance_list", []):
if slave_instance_dict.has_key("connection_xml"):
slave_instance_dict.update(self._instanceXmlToDict(
slave_instance_dict.pop("connection_xml")))
connection_dict = self._instanceXmlToDict(
slave_instance_dict.pop("connection_xml"))
slave_instance_dict.update(connection_dict)
slave_instance_dict['connection-parameter-key-list'] = \
connection_dict.keys()
if slave_instance_dict.has_key("xml"):
slave_instance_dict.update(self._instanceXmlToDict(
slave_instance_dict.pop("xml")))
slap_partition._parameter_dict.update(parameter_dict)
result = xml_marshaller.xml_marshaller.dumps(slap_partition)
# Keep in cache server for 7 days
......
......@@ -564,7 +564,26 @@ class ComputerPartition(SlapRequester):
return self._software_release_document
def setConnectionDict(self, connection_dict, slave_reference=None):
if self.getConnectionParameterDict() != connection_dict:
if self.getConnectionParameterDict() == connection_dict:
return
if slave_reference is not None:
# check the connection parameters from the slave
# Should we check existence?
slave_parameter_list = self.getInstanceParameter("slave_instance_list")
slave_connection_dict = {}
for slave_parameter_dict in slave_parameter_list:
if slave_parameter_dict["reference"] == slave_reference:
for key in slave_parameter_dict.get(
"connection-parameter-key-list", []):
slave_connection_dict[key] = slave_parameter_dict[key]
break
# Skip as nothing changed for the slave
if slave_connection_dict == connection_dict:
return
self._connection_helper.POST('setComputerPartitionConnectionXml', data={
'computer_id': self._computer_id,
'computer_partition_id': self._partition_id,
......
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