Commit 91942e1d authored by Gabriel Monnerat's avatar Gabriel Monnerat

refactor code to the paremeters be consistent with ComputerPartition.request....

refactor code to the paremeters be consistent with ComputerPartition.request. Use shared and shared_xml instead of slave_xml
parent 92d76a34
...@@ -261,7 +261,7 @@ class SlapTool(BaseTool): ...@@ -261,7 +261,7 @@ class SlapTool(BaseTool):
'requestComputerPartition') 'requestComputerPartition')
def requestComputerPartition(self, computer_id=None, def requestComputerPartition(self, computer_id=None,
computer_partition_id=None, software_release=None, software_type=None, computer_partition_id=None, software_release=None, software_type=None,
partition_reference=None, slave_xml=None, partition_parameter_xml=None, partition_reference=None, partition_parameter_xml=None,
filter_xml=None, state=None, shared_xml=_MARKER): filter_xml=None, state=None, shared_xml=_MARKER):
""" """
Asynchronously requests creation of computer partition for assigned Asynchronously requests creation of computer partition for assigned
...@@ -274,13 +274,9 @@ class SlapTool(BaseTool): ...@@ -274,13 +274,9 @@ class SlapTool(BaseTool):
In any other case returns not important data and HTTP code is 403 Forbidden In any other case returns not important data and HTTP code is 403 Forbidden
""" """
# Backward compatibility API, translate shared_xml into slave_xml.
# This should be removed as soon slap API be updated.
if shared_xml is not _MARKER:
slave_xml = shared_xml
return self._requestComputerPartition(computer_id, computer_partition_id, return self._requestComputerPartition(computer_id, computer_partition_id,
software_release, software_type, partition_reference, software_release, software_type, partition_reference,
slave_xml, partition_parameter_xml, filter_xml, state) shared_xml, partition_parameter_xml, filter_xml, state)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'useComputer') 'useComputer')
...@@ -597,7 +593,7 @@ class SlapTool(BaseTool): ...@@ -597,7 +593,7 @@ class SlapTool(BaseTool):
@convertToREST @convertToREST
def _requestComputerPartition(self, computer_id, computer_partition_id, def _requestComputerPartition(self, computer_id, computer_partition_id,
software_release, software_type, partition_reference, software_release, software_type, partition_reference,
slave_xml, partition_parameter_xml, filter_xml, state): shared_xml, partition_parameter_xml, filter_xml, state):
""" """
Asynchronously requests creation of computer partition for assigned Asynchronously requests creation of computer partition for assigned
parameters parameters
...@@ -614,10 +610,10 @@ class SlapTool(BaseTool): ...@@ -614,10 +610,10 @@ class SlapTool(BaseTool):
state = xml_marshaller.xml_marshaller.loads(state) state = xml_marshaller.xml_marshaller.loads(state)
if state is None: if state is None:
state = 'started' state = 'started'
if slave_xml: if shared_xml is not _MARKER:
slave = xml_marshaller.xml_marshaller.loads(slave_xml) shared = xml_marshaller.xml_marshaller.loads(shared_xml)
else: else:
slave = False shared = False
if partition_parameter_xml: if partition_parameter_xml:
partition_parameter_kw = xml_marshaller.xml_marshaller.loads( partition_parameter_kw = xml_marshaller.xml_marshaller.loads(
partition_parameter_xml) partition_parameter_xml)
...@@ -646,7 +642,7 @@ class SlapTool(BaseTool): ...@@ -646,7 +642,7 @@ class SlapTool(BaseTool):
sla_xml = etree.tostring(instance, pretty_print=True, sla_xml = etree.tostring(instance, pretty_print=True,
xml_declaration=True, encoding='utf-8') xml_declaration=True, encoding='utf-8')
if slave: if shared:
instance_portal_type = "Slave Instance" instance_portal_type = "Slave Instance"
else: else:
instance_portal_type = "Software Instance" instance_portal_type = "Software Instance"
...@@ -661,7 +657,7 @@ class SlapTool(BaseTool): ...@@ -661,7 +657,7 @@ class SlapTool(BaseTool):
software_type=software_type, software_type=software_type,
partition_reference=partition_reference, partition_reference=partition_reference,
instance_xml=instance_xml, instance_xml=instance_xml,
slave=slave, shared=shared,
sla_xml=sla_xml, sla_xml=sla_xml,
state=state) state=state)
...@@ -683,7 +679,7 @@ class SlapTool(BaseTool): ...@@ -683,7 +679,7 @@ class SlapTool(BaseTool):
person.requestSoftwareInstance(software_release=software_release, person.requestSoftwareInstance(software_release=software_release,
software_type=software_type, software_type=software_type,
software_title=partition_reference, software_title=partition_reference,
slave=slave, shared=shared,
instance_xml=instance_xml, instance_xml=instance_xml,
sla_xml=sla_xml, sla_xml=sla_xml,
state=state) state=state)
...@@ -701,7 +697,7 @@ class SlapTool(BaseTool): ...@@ -701,7 +697,7 @@ class SlapTool(BaseTool):
raise SoftwareInstanceNotReady raise SoftwareInstanceNotReady
else: else:
query_kw = {} query_kw = {}
if slave: if shared:
# Provide precise reference when search for a slave. # Provide precise reference when search for a slave.
query_kw['slave_reference'] = requested_software_instance.getReference() query_kw['slave_reference'] = requested_software_instance.getReference()
......
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