Commit 508ce51f authored by Romain Courteaud's avatar Romain Courteaud

Unused

parent 4592c090
...@@ -80,74 +80,6 @@ def SoftwareInstance_bangAsSelf(self, relative_url=None, reference=None, ...@@ -80,74 +80,6 @@ def SoftwareInstance_bangAsSelf(self, relative_url=None, reference=None,
# Restore the original user. # Restore the original user.
setSecurityManager(sm) setSecurityManager(sm)
def SoftwareInstance_requestDestroySlaveInstanceRelated(self):
""" request destroy all Slave Instance allocated in the Computer Partition
related to the Software Instance """
sm = getSecurityManager()
portal = self.getPortalObject()
service_relative_url = portal.portal_preferences.getPreferredInstanceCleanupResource()
newSecurityManager(None, portal.acl_users.getUserById(
self.getReference()))
computer_partition_relative_url = self.getAggregateRelatedValue(
"Sale Packing List Line").getAggregate(portal_type="Computer Partition")
portal_preferences = portal.portal_preferences
service_uid_list = [
portal.restrictedTraverse(portal_preferences.getPreferredInstanceHostingResource()).getUid(),
portal.restrictedTraverse(portal_preferences.getPreferredInstanceSetupResource()).getUid(),
]
try:
result_list = self.portal_catalog(portal_type="Sale Packing List Line",
aggregate_portal_type="Slave Instance",
computer_partition_relative_url=computer_partition_relative_url,
default_resource_uid=service_uid_list)
slave_instance_list = [line.getAggregateValue(portal_type="Slave Instance") for line in result_list]
uid_list = []
for slave_instance in slave_instance_list:
slave_instance_uid = slave_instance.getUid()
if slave_instance_uid in uid_list:
continue
cleanup_packing_list = self.portal_catalog(
portal_type='Sale Packing List Line',
aggregate_relative_url=slave_instance.getRelativeUrl(),
resource_relative_url=service_relative_url,
limit=1,
)
if len(cleanup_packing_list) == 0:
uid_list.append(slave_instance_uid)
slave_instance.requestDestroyComputerPartition()
finally:
# Restore the original user.
setSecurityManager(sm)
def SoftwareInstance_destroySlaveInstanceRelated(self):
""" destroy all Slave Instance allocated in the Computer Partition
related to the Software Instance """
sm = getSecurityManager()
newSecurityManager(None, self.getPortalObject().acl_users.getUserById(
self.getReference()))
portal = self.getPortalObject()
portal_preferences = portal.portal_preferences
computer_partition_relative_url = self.getAggregateRelatedValue(
"Sale Packing List Line").getAggregate(portal_type="Computer Partition")
simulation_state = ["confirmed"]
service_uid_list = [
portal.restrictedTraverse(portal_preferences.getPreferredInstanceCleanupResource()).getUid(),
]
try:
result_list = self.portal_catalog(portal_type="Sale Packing List Line",
aggregate_portal_type="Slave Instance",
computer_partition_relative_url=computer_partition_relative_url,
simulation_state=simulation_state,
default_resource_uid=service_uid_list)
slave_instance_list = [line.getAggregateValue(portal_type="Slave Instance") for line in result_list]
# restore the original user to destroy each Slave Instance
setSecurityManager(sm)
for slave_instance in slave_instance_list:
slave_instance.destroyComputerPartition()
finally:
# Restore the original user.
setSecurityManager(sm)
def getComputerSecurityCategory(self, base_category_list, user_name, def getComputerSecurityCategory(self, base_category_list, user_name,
object, portal_type): object, portal_type):
""" """
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>SoftwareInstance_destroySlaveInstanceRelated</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>VifibSecurity</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareInstance_destroySlaveInstanceRelated</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>SoftwareInstance_requestDestroySlaveInstanceRelated</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>VifibSecurity</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareInstance_requestDestroySlaveInstanceRelated</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
431 432
\ No newline at end of file \ No newline at end of file
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