Commit e165743c authored by Gabriel Monnerat's avatar Gabriel Monnerat

Refactor code to find correctly a Software Instance, because if...

Refactor code to find correctly a Software Instance, because if slave_reference is None the query must ensure that Slave Instance will be ignored
parent 4e16de14
...@@ -774,10 +774,14 @@ class SlapTool(BaseTool): ...@@ -774,10 +774,14 @@ class SlapTool(BaseTool):
state_list.extend(portal.getPortalCurrentInventoryStateList()) state_list.extend(portal.getPortalCurrentInventoryStateList())
state_list.extend(portal.getPortalReservedInventoryStateList()) state_list.extend(portal.getPortalReservedInventoryStateList())
state_list.extend(portal.getPortalTransitInventoryStateList()) state_list.extend(portal.getPortalTransitInventoryStateList())
aggregate_dict = {"aggregate_relative_url" : \
computer_partition_document.getRelativeUrl()}
if slave_reference is not None: if slave_reference is not None:
aggregate_dict["aggregate_reference"] = slave_reference query = ComplexQuery(Query(aggregate_reference=slave_reference),
Query(aggregate_relative_url=computer_partition_document.getRelativeUrl()),
operator="AND")
else:
query = ComplexQuery(Query(aggregate_portal_type="Software Instance"),
Query(aggregate_relative_url=computer_partition_document.getRelativeUrl()),
operator="AND")
# Use getTrackingList # Use getTrackingList
catalog_result = portal.portal_catalog( catalog_result = portal.portal_catalog(
...@@ -786,7 +790,7 @@ class SlapTool(BaseTool): ...@@ -786,7 +790,7 @@ class SlapTool(BaseTool):
default_resource_uid=service_uid_list, default_resource_uid=service_uid_list,
sort_on=(('movement.start_date', 'DESC'),), sort_on=(('movement.start_date', 'DESC'),),
limit=1, limit=1,
**aggregate_dict query=query
) )
if len(catalog_result): if len(catalog_result):
return catalog_result[0].getObject() return catalog_result[0].getObject()
......
...@@ -4725,7 +4725,7 @@ class TestVifibSlapWebService(testVifibMixin): ...@@ -4725,7 +4725,7 @@ class TestVifibSlapWebService(testVifibMixin):
Tic Tic
Logout Logout
LoginDefaultUser LoginDefaultUser
CheckComputerPartitionInstanceHostingSalePackingListConfirmed CheckComputerPartitionInstanceSetupSalePackingListConfirmed
Logout Logout
""" """
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
...@@ -4752,7 +4752,7 @@ class TestVifibSlapWebService(testVifibMixin): ...@@ -4752,7 +4752,7 @@ class TestVifibSlapWebService(testVifibMixin):
Tic Tic
Logout Logout
LoginDefaultUser LoginDefaultUser
CheckComputerPartitionInstanceHostingSalePackingListStopped CheckComputerPartitionInstanceSetupSalePackingListStopped
Logout Logout
""" """
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
......
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