Commit 65f8d096 authored by Rafael Monnerat's avatar Rafael Monnerat

Convert Shared to Slave, but preserve Backward Compatibility of API.

parent 7c121912
...@@ -92,6 +92,8 @@ def convertToREST(function): ...@@ -92,6 +92,8 @@ def convertToREST(function):
wrapper.__doc__ = function.__doc__ wrapper.__doc__ = function.__doc__
return wrapper return wrapper
_MARKER = []
class SlapTool(BaseTool): class SlapTool(BaseTool):
"""SlapTool""" """SlapTool"""
...@@ -259,8 +261,8 @@ class SlapTool(BaseTool): ...@@ -259,8 +261,8 @@ 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, shared_xml=None, partition_parameter_xml=None, partition_reference=None, slave_xml=None, partition_parameter_xml=None,
filter_xml=None, state=None): filter_xml=None, state=None, shared_xml=_MARKER):
""" """
Asynchronously requests creation of computer partition for assigned Asynchronously requests creation of computer partition for assigned
parameters parameters
...@@ -272,9 +274,13 @@ class SlapTool(BaseTool): ...@@ -272,9 +274,13 @@ 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,
shared_xml, partition_parameter_xml, filter_xml, state) slave_xml, partition_parameter_xml, filter_xml, state)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'useComputer') 'useComputer')
...@@ -552,7 +558,7 @@ class SlapTool(BaseTool): ...@@ -552,7 +558,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,
shared_xml, partition_parameter_xml, filter_xml, state): slave_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
...@@ -569,10 +575,10 @@ class SlapTool(BaseTool): ...@@ -569,10 +575,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 shared_xml: if slave_xml:
shared = xml_marshaller.xml_marshaller.loads(shared_xml) slave = xml_marshaller.xml_marshaller.loads(slave_xml)
else: else:
shared = False slave = 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)
......
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