Commit 41740ae2 authored by Łukasz Nowak's avatar Łukasz Nowak

Use filter instead of new sla_parameter to have backward compatibility.

parent 0febf457
...@@ -61,7 +61,7 @@ hosting_subscription_uid = state_change.kwargs[\'hosting_subscription_uid\']\n ...@@ -61,7 +61,7 @@ hosting_subscription_uid = state_change.kwargs[\'hosting_subscription_uid\']\n
shared = state_change.kwargs[\'shared\']\n shared = state_change.kwargs[\'shared\']\n
software_type = state_change.kwargs["software_type"]\n software_type = state_change.kwargs["software_type"]\n
tag = state_change.kwargs[\'tag\']\n tag = state_change.kwargs[\'tag\']\n
sla_parameter_kw = kwargs["sla_parameter_kw"]\n filter_kw = kwargs["filter_kw"]\n
\n \n
# Assertion: No packing list line should be related to this software instance\n # Assertion: No packing list line should be related to this software instance\n
packing_list_line = software_instance.getAggregateRelatedValue(portal_type=\'Sale Packing List Line\')\n packing_list_line = software_instance.getAggregateRelatedValue(portal_type=\'Sale Packing List Line\')\n
...@@ -79,8 +79,8 @@ query_kw = {\n ...@@ -79,8 +79,8 @@ query_kw = {\n
\'portal_type\': \'Computer Partition\'\n \'portal_type\': \'Computer Partition\'\n
}\n }\n
# support SLA\n # support SLA\n
if "computer_guid" in sla_parameter_kw:\n if "computer_guid" in filter_kw:\n
query_kw["parent_reference"] = sla_parameter_kw["computer_guid"]\n query_kw["parent_reference"] = filter_kw["computer_guid"]\n
\n \n
# fetch at mot 50 random Computer Partitions, and check if they are ok\n # fetch at mot 50 random Computer Partitions, and check if they are ok\n
isTransitionPossible = software_instance.getPortalObject().portal_workflow.isTransitionPossible\n isTransitionPossible = software_instance.getPortalObject().portal_workflow.isTransitionPossible\n
......
...@@ -62,7 +62,6 @@ shared = kwargs["shared"]\n ...@@ -62,7 +62,6 @@ shared = kwargs["shared"]\n
software_type = kwargs["software_type"]\n software_type = kwargs["software_type"]\n
instance_xml = kwargs["instance_xml"]\n instance_xml = kwargs["instance_xml"]\n
filter_kw = kwargs["filter_kw"]\n filter_kw = kwargs["filter_kw"]\n
sla_parameter_kw = kwargs["sla_parameter_kw"]\n
\n \n
# Get root software instance\n # Get root software instance\n
predecessor_software_instance = software_instance\n predecessor_software_instance = software_instance\n
...@@ -110,7 +109,7 @@ if (request_software_instance is None):\n ...@@ -110,7 +109,7 @@ if (request_software_instance is None):\n
shared=shared,\n shared=shared,\n
software_type=software_type,\n software_type=software_type,\n
tag=tag,\n tag=tag,\n
sla_parameter_kw=sla_parameter_kw)\n filter_kw=filter_kw)\n
else:\n else:\n
# Update existing software instance\n # Update existing software instance\n
# Sale Packing List interaction has to be requested automatically with an interaction workflow\n # Sale Packing List interaction has to be requested automatically with an interaction workflow\n
......
...@@ -244,7 +244,7 @@ class SlapTool(BaseTool): ...@@ -244,7 +244,7 @@ class SlapTool(BaseTool):
security.declareProtected(Permissions.AccessContentsInformation, 'requestComputerPartition') security.declareProtected(Permissions.AccessContentsInformation, 'requestComputerPartition')
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, sla_parameter_xml): shared_xml, partition_parameter_xml, filter_xml):
""" """
Asynchronously requests creation of computer partition for assigned Asynchronously requests creation of computer partition for assigned
parameters parameters
...@@ -258,7 +258,7 @@ class SlapTool(BaseTool): ...@@ -258,7 +258,7 @@ class SlapTool(BaseTool):
""" """
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, sla_parameter_xml) shared_xml, partition_parameter_xml, filter_xml)
security.declareProtected(Permissions.AccessContentsInformation, 'useComputer') security.declareProtected(Permissions.AccessContentsInformation, 'useComputer')
def useComputer(self, computer_id, use_string): def useComputer(self, computer_id, use_string):
...@@ -544,7 +544,7 @@ class SlapTool(BaseTool): ...@@ -544,7 +544,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, sla_parameter_xml): shared_xml, partition_parameter_xml, filter_xml):
""" """
Asynchronously requests creation of computer partition for assigned Asynchronously requests creation of computer partition for assigned
parameters parameters
...@@ -565,11 +565,6 @@ class SlapTool(BaseTool): ...@@ -565,11 +565,6 @@ class SlapTool(BaseTool):
partition_parameter_xml) partition_parameter_xml)
else: else:
partition_parameter_kw = dict() partition_parameter_kw = dict()
if sla_parameter_xml:
sla_parameter_kw = xml_marshaller.xml_marshaller.loads(
sla_parameter_xml)
else:
sla_parameter_kw = dict()
if filter_xml: if filter_xml:
filter_kw = xml_marshaller.xml_marshaller.loads(filter_xml) filter_kw = xml_marshaller.xml_marshaller.loads(filter_xml)
else: else:
...@@ -593,8 +588,7 @@ class SlapTool(BaseTool): ...@@ -593,8 +588,7 @@ class SlapTool(BaseTool):
partition_reference=partition_reference, partition_reference=partition_reference,
shared=shared, shared=shared,
instance_xml=instance_xml, instance_xml=instance_xml,
filter_kw=filter_kw, filter_kw=filter_kw)
sla_parameter_kw=sla_parameter_kw)
# Get requested software instance # Get requested software instance
requested_software_instance = software_instance_document.portal_catalog.\ requested_software_instance = software_instance_document.portal_catalog.\
......
...@@ -149,16 +149,16 @@ class OpenOrder(SlapDocument): ...@@ -149,16 +149,16 @@ class OpenOrder(SlapDocument):
zope.interface.implements(interface.IOpenOrder) zope.interface.implements(interface.IOpenOrder)
def request(self, software_release, partition_reference, def request(self, software_release, partition_reference,
partition_parameter_kw=None, software_type=None, sla_parameter_kw=None): partition_parameter_kw=None, software_type=None, filter_kw=None):
if partition_parameter_kw is None: if partition_parameter_kw is None:
partition_parameter_kw = {} partition_parameter_kw = {}
if sla_parameter_kw is None: if filter_kw is None:
sla_parameter_kw = {} filter_kw = {}
request_dict = { request_dict = {
'software_release': software_release, 'software_release': software_release,
'partition_reference': partition_reference, 'partition_reference': partition_reference,
'partition_parameter_xml': xml_marshaller.dumps(partition_parameter_kw), 'partition_parameter_xml': xml_marshaller.dumps(partition_parameter_kw),
'sla_parameter_xml': xml_marshaller.dumps(sla_parameter_kw) 'filter_xml': xml_marshaller.dumps(filter_kw)
} }
if software_type is not None: if software_type is not None:
request_dict['software_type'] = software_type request_dict['software_type'] = software_type
...@@ -282,12 +282,9 @@ class ComputerPartition(SlapDocument): ...@@ -282,12 +282,9 @@ class ComputerPartition(SlapDocument):
# Computer Partition data are fetch from server shall be delayed # Computer Partition data are fetch from server shall be delayed
@_syncComputerPartitionInformation @_syncComputerPartitionInformation
def request(self, software_release, software_type, partition_reference, def request(self, software_release, software_type, partition_reference,
shared=False, partition_parameter_kw=None, filter_kw=None, shared=False, partition_parameter_kw=None, filter_kw=None):
sla_parameter_kw=None):
if partition_parameter_kw is None: if partition_parameter_kw is None:
partition_parameter_kw = {} partition_parameter_kw = {}
if sla_parameter_kw is None:
sla_parameter_kw = {}
elif not isinstance(partition_parameter_kw, dict): elif not isinstance(partition_parameter_kw, dict):
raise ValueError("Unexpected type of partition_parameter_kw '%s'" % \ raise ValueError("Unexpected type of partition_parameter_kw '%s'" % \
partition_parameter_kw) partition_parameter_kw)
...@@ -307,7 +304,6 @@ class ComputerPartition(SlapDocument): ...@@ -307,7 +304,6 @@ class ComputerPartition(SlapDocument):
'partition_parameter_xml': xml_marshaller.dumps( 'partition_parameter_xml': xml_marshaller.dumps(
partition_parameter_kw), partition_parameter_kw),
'filter_xml': xml_marshaller.dumps(filter_kw), 'filter_xml': xml_marshaller.dumps(filter_kw),
'sla_parameter_xml': xml_marshaller.dumps(sla_parameter_kw)
} }
self._connection_helper.POST('/requestComputerPartition', request_dict) self._connection_helper.POST('/requestComputerPartition', request_dict)
xml = self._connection_helper.response.read() xml = self._connection_helper.response.read()
......
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