diff --git a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/HostingSubscription_getInstancePackingListLine.xml b/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/HostingSubscription_getInstancePackingListLine.xml deleted file mode 100644 index 85890c64cb94008a43fc7387ef1a8eee9b8ad306..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/HostingSubscription_getInstancePackingListLine.xml +++ /dev/null @@ -1,108 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </value> - </item> - <item> - <key> <string>_bind_names</string> </key> - <value> - <object> - <klass> - <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> - </klass> - <tuple/> - <state> - <dictionary> - <item> - <key> <string>_asgns</string> </key> - <value> - <dictionary> - <item> - <key> <string>name_container</string> </key> - <value> <string>container</string> </value> - </item> - <item> - <key> <string>name_context</string> </key> - <value> <string>context</string> </value> - </item> - <item> - <key> <string>name_m_self</string> </key> - <value> <string>script</string> </value> - </item> - <item> - <key> <string>name_subpath</string> </key> - <value> <string>traverse_subpath</string> </value> - </item> - </dictionary> - </value> - </item> - </dictionary> - </state> - </object> - </value> - </item> - <item> - <key> <string>_body</string> </key> - <value> <string>software_instance = state_change[\'object\']\n -hosting_subscription_uid = state_change.kwargs[\'hosting_subscription_uid\']\n -hosting_subscription = software_instance.portal_catalog.getResultValue(uid=hosting_subscription_uid)\n -portal = software_instance.getPortalObject()\n -\n -# Get services\n -portal_preferences = portal.portal_preferences\n -service_uid_list = []\n -\n -if service_relative_url is None:\n - for service_relative_url in \\\n - (portal_preferences.getPreferredInstanceSetupResource(),\n - portal_preferences.getPreferredInstanceHostingResource(),\n - portal_preferences.getPreferredInstanceCleanupResource(),\n - portal_preferences.getPreferredInstanceUpdateResource(),\n - ):\n - service = portal.restrictedTraverse(service_relative_url)\n - service_uid_list.append(service.getUid())\n -else:\n - service = portal.restrictedTraverse(service_relative_url)\n - service_uid_list.append(service.getUid())\n -\n -# Packing List valid state\n -state_list = []\n -state_list.extend(portal.getPortalReservedInventoryStateList())\n -state_list.extend(portal.getPortalTransitInventoryStateList())\n -state_list.extend([\'stopped\'])\n -\n -packing_list_line = portal.portal_catalog.getResultValue(\n - portal_type=\'Sale Packing List Line\',\n - simulation_state=state_list,\n - aggregate_uid=hosting_subscription_uid,\n - default_resource_uid=service_uid_list,\n - sort_on=((\'movement.start_date\', \'DESC\'),),\n - limit=1,\n -)\n -\n -if packing_list_line is None:\n - raise ValueError("No sale packing list line found for %s" % \\\n - hosting_subscription.getRelativeUrl())\n -else:\n - return packing_list_line\n -</string> </value> - </item> - <item> - <key> <string>_params</string> </key> - <value> <string>state_change, service_relative_url=None</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>HostingSubscription_getInstancePackingListLine</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_checkConsistency.xml b/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_checkConsistency.xml deleted file mode 100644 index 35859944d3d32793d2c42c7f1bb06bbb4ddc42e6..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_checkConsistency.xml +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </value> - </item> - <item> - <key> <string>_bind_names</string> </key> - <value> - <object> - <klass> - <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> - </klass> - <tuple/> - <state> - <dictionary> - <item> - <key> <string>_asgns</string> </key> - <value> - <dictionary> - <item> - <key> <string>name_container</string> </key> - <value> <string>container</string> </value> - </item> - <item> - <key> <string>name_context</string> </key> - <value> <string>context</string> </value> - </item> - <item> - <key> <string>name_m_self</string> </key> - <value> <string>script</string> </value> - </item> - <item> - <key> <string>name_subpath</string> </key> - <value> <string>traverse_subpath</string> </value> - </item> - </dictionary> - </value> - </item> - </dictionary> - </state> - </object> - </value> - </item> - <item> - <key> <string>_body</string> </key> - <value> <string>software_instance = state_change[\'object\']\n -software_instance.Base_checkConsistency()\n -</string> </value> - </item> - <item> - <key> <string>_params</string> </key> - <value> <string>state_change</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>SoftwareInstance_checkConsistency</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_createSalePackingList.xml b/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_createSalePackingList.xml deleted file mode 100644 index 7bc9e3b71c0b3b07c8d05f9fa523c487f3c42185..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_createSalePackingList.xml +++ /dev/null @@ -1,102 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </value> - </item> - <item> - <key> <string>_bind_names</string> </key> - <value> - <object> - <klass> - <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> - </klass> - <tuple/> - <state> - <dictionary> - <item> - <key> <string>_asgns</string> </key> - <value> - <dictionary> - <item> - <key> <string>name_container</string> </key> - <value> <string>container</string> </value> - </item> - <item> - <key> <string>name_context</string> </key> - <value> <string>context</string> </value> - </item> - <item> - <key> <string>name_m_self</string> </key> - <value> <string>script</string> </value> - </item> - <item> - <key> <string>name_subpath</string> </key> - <value> <string>traverse_subpath</string> </value> - </item> - </dictionary> - </value> - </item> - </dictionary> - </state> - </object> - </value> - </item> - <item> - <key> <string>_body</string> </key> - <value> <string>software_instance = state_change[\'object\']\n -instance_setup_sale_packing_list_line = \\\n - context.SoftwareInstance_getInstancePackingListLine(\n - state_change, \n - service_relative_url=software_instance.portal_preferences.\\\n - getPreferredInstanceSetupResource())\n -instance_setup_sale_packing_list = instance_setup_sale_packing_list_line.getParentValue()\n -portal = context.getPortalObject()\n -sale_packing_list_module = portal.getDefaultModule(portal_type=\'Sale Packing List\')\n -if tag is not None:\n - activate_kw = {\'tag\': tag}\n -else:\n - activate_kw = None\n -sale_packing_list = sale_packing_list_module.newContent(\n - portal_type=\'Sale Packing List\',\n - specialise=instance_setup_sale_packing_list.getSpecialise() or instance_setup_sale_packing_list.getCausalityValue().getSpecialise(),\n - destination=instance_setup_sale_packing_list.getDestination(),\n - destination_section=instance_setup_sale_packing_list.getDestinationSection(),\n - destination_decision_=instance_setup_sale_packing_list.getDestinationDecision(),\n - source=instance_setup_sale_packing_list.getSource(),\n - source_section=instance_setup_sale_packing_list.getSourceSection(),\n - price_currency=instance_setup_sale_packing_list.getPriceCurrency(),\n - start_date=DateTime(),\n - activate_kw=activate_kw)\n -\n -service = portal.restrictedTraverse(service_relative_url)\n -instance_hosting_sale_packing_list_line = sale_packing_list.newContent(\n - portal_type=\'Sale Packing List Line\',\n - resource=service_relative_url,\n - quantity=instance_setup_sale_packing_list_line.getQuantity(),\n - aggregate_list=instance_setup_sale_packing_list_line.getAggregateList(),\n - # XXX Hardcode price on service\n - price=service.getSaleSupplyLineBasePrice(),\n - activate_kw=activate_kw\n -)\n -return sale_packing_list\n -</string> </value> - </item> - <item> - <key> <string>_params</string> </key> - <value> <string>state_change, service_relative_url, tag=None</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>SoftwareInstance_createSalePackingList</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_deliverActiveInstanceUpdatePackingListLine.xml b/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_deliverActiveInstanceUpdatePackingListLine.xml deleted file mode 100644 index 41897e69519ca8e6424512131d06a969c34bc104..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_deliverActiveInstanceUpdatePackingListLine.xml +++ /dev/null @@ -1,82 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </value> - </item> - <item> - <key> <string>_bind_names</string> </key> - <value> - <object> - <klass> - <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> - </klass> - <tuple/> - <state> - <dictionary> - <item> - <key> <string>_asgns</string> </key> - <value> - <dictionary> - <item> - <key> <string>name_container</string> </key> - <value> <string>container</string> </value> - </item> - <item> - <key> <string>name_context</string> </key> - <value> <string>context</string> </value> - </item> - <item> - <key> <string>name_m_self</string> </key> - <value> <string>script</string> </value> - </item> - <item> - <key> <string>name_subpath</string> </key> - <value> <string>traverse_subpath</string> </value> - </item> - </dictionary> - </value> - </item> - </dictionary> - </state> - </object> - </value> - </item> - <item> - <key> <string>_body</string> </key> - <value> <string>software_instance = state_change[\'object\']\n -service_relative_url = software_instance.portal_preferences.\\\n - getPreferredInstanceUpdateResource()\n -try:\n - line = context.SoftwareInstance_getInstancePackingListLine(\n - state_change, \n - service_relative_url=service_relative_url,\n - state_list=[\'confirmed\'])\n -except ValueError:\n - return False\n -else:\n - delivery = line.getParentValue()\n - delivery.start()\n - delivery.stop()\n - delivery.deliver()\n - return True\n -</string> </value> - </item> - <item> - <key> <string>_params</string> </key> - <value> <string>state_change</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>SoftwareInstance_deliverActiveInstanceUpdatePackingListLine</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_getInstanceDestroyPackingListLine.xml b/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_getInstanceDestroyPackingListLine.xml deleted file mode 100644 index 281aca2eb931595d8ce3f81d67710d7dc1efd403..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_getInstanceDestroyPackingListLine.xml +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </value> - </item> - <item> - <key> <string>_bind_names</string> </key> - <value> - <object> - <klass> - <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> - </klass> - <tuple/> - <state> - <dictionary> - <item> - <key> <string>_asgns</string> </key> - <value> - <dictionary> - <item> - <key> <string>name_container</string> </key> - <value> <string>container</string> </value> - </item> - <item> - <key> <string>name_context</string> </key> - <value> <string>context</string> </value> - </item> - <item> - <key> <string>name_m_self</string> </key> - <value> <string>script</string> </value> - </item> - <item> - <key> <string>name_subpath</string> </key> - <value> <string>traverse_subpath</string> </value> - </item> - </dictionary> - </value> - </item> - </dictionary> - </state> - </object> - </value> - </item> - <item> - <key> <string>_body</string> </key> - <value> <string>software_instance = state_change[\'object\']\n -service_relative_url = software_instance.portal_preferences.\\\n - getPreferredInstanceCleanupResource()\n -return context.SoftwareInstance_getInstancePackingListLine(\n - state_change, \n - service_relative_url=service_relative_url)\n -</string> </value> - </item> - <item> - <key> <string>_params</string> </key> - <value> <string>state_change</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>SoftwareInstance_getInstanceDestroyPackingListLine</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_getInstanceHostingPackingListLine.xml b/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_getInstanceHostingPackingListLine.xml deleted file mode 100644 index 1dbd324955803cf495dcf395c6fbfabd52b095af..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_getInstanceHostingPackingListLine.xml +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </value> - </item> - <item> - <key> <string>_bind_names</string> </key> - <value> - <object> - <klass> - <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> - </klass> - <tuple/> - <state> - <dictionary> - <item> - <key> <string>_asgns</string> </key> - <value> - <dictionary> - <item> - <key> <string>name_container</string> </key> - <value> <string>container</string> </value> - </item> - <item> - <key> <string>name_context</string> </key> - <value> <string>context</string> </value> - </item> - <item> - <key> <string>name_m_self</string> </key> - <value> <string>script</string> </value> - </item> - <item> - <key> <string>name_subpath</string> </key> - <value> <string>traverse_subpath</string> </value> - </item> - </dictionary> - </value> - </item> - </dictionary> - </state> - </object> - </value> - </item> - <item> - <key> <string>_body</string> </key> - <value> <string>software_instance = state_change[\'object\']\n -service_relative_url = software_instance.portal_preferences.\\\n - getPreferredInstanceHostingResource()\n -return context.SoftwareInstance_getInstancePackingListLine(\n - state_change, \n - service_relative_url=service_relative_url)\n -</string> </value> - </item> - <item> - <key> <string>_params</string> </key> - <value> <string>state_change</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>SoftwareInstance_getInstanceHostingPackingListLine</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_getInstancePackingListLine.xml b/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_getInstancePackingListLine.xml deleted file mode 100644 index a1d01fd6b9e08e037bfb115f473b886aed2dfb03..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_getInstancePackingListLine.xml +++ /dev/null @@ -1,108 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </value> - </item> - <item> - <key> <string>_bind_names</string> </key> - <value> - <object> - <klass> - <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> - </klass> - <tuple/> - <state> - <dictionary> - <item> - <key> <string>_asgns</string> </key> - <value> - <dictionary> - <item> - <key> <string>name_container</string> </key> - <value> <string>container</string> </value> - </item> - <item> - <key> <string>name_context</string> </key> - <value> <string>context</string> </value> - </item> - <item> - <key> <string>name_m_self</string> </key> - <value> <string>script</string> </value> - </item> - <item> - <key> <string>name_subpath</string> </key> - <value> <string>traverse_subpath</string> </value> - </item> - </dictionary> - </value> - </item> - </dictionary> - </state> - </object> - </value> - </item> - <item> - <key> <string>_body</string> </key> - <value> <string>software_instance = state_change[\'object\']\n -\n -portal = software_instance.getPortalObject()\n -\n -# Get services\n -portal_preferences = portal.portal_preferences\n -service_uid_list = []\n -\n -if service_relative_url is None:\n - for service_relative_url in \\\n - (portal_preferences.getPreferredInstanceSetupResource(),\n - portal_preferences.getPreferredInstanceHostingResource(),\n - portal_preferences.getPreferredInstanceCleanupResource(),\n - portal_preferences.getPreferredInstanceUpdateResource(),\n - ):\n - service = portal.restrictedTraverse(service_relative_url)\n - service_uid_list.append(service.getUid())\n -else:\n - service = portal.restrictedTraverse(service_relative_url)\n - service_uid_list.append(service.getUid())\n -\n -# Packing List valid state\n -if state_list is None:\n - state_list = []\n - state_list.extend(portal.getPortalReservedInventoryStateList())\n - state_list.extend(portal.getPortalTransitInventoryStateList())\n - state_list.extend([\'stopped\'])\n -\n -packing_list_line = portal.portal_catalog.getResultValue(\n - portal_type=\'Sale Packing List Line\',\n - simulation_state=state_list,\n - aggregate_uid=software_instance.getUid(),\n - default_resource_uid=service_uid_list,\n - sort_on=((\'movement.start_date\', \'DESC\'),),\n - limit=1,\n -)\n -\n -if packing_list_line is None:\n - raise ValueError("No sale packing list line found for %s" % \\\n - software_instance.getRelativeUrl())\n -else:\n - return packing_list_line\n -</string> </value> - </item> - <item> - <key> <string>_params</string> </key> - <value> <string>state_change, service_relative_url=None, state_list=None</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>SoftwareInstance_getInstancePackingListLine</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_getInstanceSetupPackingListLine.xml b/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_getInstanceSetupPackingListLine.xml deleted file mode 100644 index 0bb1d7672e09bf7f4a934279264df3f76078d5bc..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_getInstanceSetupPackingListLine.xml +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </value> - </item> - <item> - <key> <string>_bind_names</string> </key> - <value> - <object> - <klass> - <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> - </klass> - <tuple/> - <state> - <dictionary> - <item> - <key> <string>_asgns</string> </key> - <value> - <dictionary> - <item> - <key> <string>name_container</string> </key> - <value> <string>container</string> </value> - </item> - <item> - <key> <string>name_context</string> </key> - <value> <string>context</string> </value> - </item> - <item> - <key> <string>name_m_self</string> </key> - <value> <string>script</string> </value> - </item> - <item> - <key> <string>name_subpath</string> </key> - <value> <string>traverse_subpath</string> </value> - </item> - </dictionary> - </value> - </item> - </dictionary> - </state> - </object> - </value> - </item> - <item> - <key> <string>_body</string> </key> - <value> <string>software_instance = state_change[\'object\']\n -service_relative_url = software_instance.portal_preferences.\\\n - getPreferredInstanceSetupResource()\n -return context.SoftwareInstance_getInstancePackingListLine(\n - state_change, \n - service_relative_url=service_relative_url)\n -</string> </value> - </item> - <item> - <key> <string>_params</string> </key> - <value> <string>state_change</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>SoftwareInstance_getInstanceSetupPackingListLine</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestDestroy.xml b/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestDestroy.xml deleted file mode 100644 index 1a4678b83a40fdeb79a4aa861514e0f52a96b2fd..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestDestroy.xml +++ /dev/null @@ -1,91 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </value> - </item> - <item> - <key> <string>_bind_names</string> </key> - <value> - <object> - <klass> - <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> - </klass> - <tuple/> - <state> - <dictionary> - <item> - <key> <string>_asgns</string> </key> - <value> - <dictionary> - <item> - <key> <string>name_container</string> </key> - <value> <string>container</string> </value> - </item> - <item> - <key> <string>name_context</string> </key> - <value> <string>context</string> </value> - </item> - <item> - <key> <string>name_m_self</string> </key> - <value> <string>script</string> </value> - </item> - <item> - <key> <string>name_subpath</string> </key> - <value> <string>traverse_subpath</string> </value> - </item> - </dictionary> - </value> - </item> - </dictionary> - </state> - </object> - </value> - </item> - <item> - <key> <string>_body</string> </key> - <value> <string encoding="cdata"><![CDATA[ - -software_instance = state_change[\'object\']\n -tag = "%s_destroyInProgress" % software_instance.getUid()\n -portal = context.getPortalObject()\n -if (portal.portal_activities.countMessageWithTag(tag) > 0):\n - raise ValueError("Software Instance is currently being destroyed.")\n -# lock software instance in transaction\n -software_instance.serialize()\n -\n -sale_order_line = software_instance.getAggregateRelatedValue(portal_type=\'Sale Order Line\')\n -\n -if sale_order_line is not None and sale_order_line.getSimulationState() == \'ordered\':\n - # tries to destroy not yet even allocated one\n - sale_order_line.getParentValue().cancel()\n -else:\n - service_relative_url = software_instance.portal_preferences.\\\n - getPreferredInstanceCleanupResource()\n - sale_packing_list = context.SoftwareInstance_createSalePackingList(state_change, service_relative_url, tag=tag)\n - sale_packing_list.confirm(activate_kw={\'tag\':tag})\n -\n - if software_instance.getPortalType() == "Software Instance":\n - software_instance.SoftwareInstance_requestDestroySlaveInstanceRelated()\n - - -]]></string> </value> - </item> - <item> - <key> <string>_params</string> </key> - <value> <string>state_change</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>SoftwareInstance_requestDestroy</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestStart.xml b/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestStart.xml deleted file mode 100644 index 3803adb330134deabd0ed989f0ebc81ce9b7fc09..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestStart.xml +++ /dev/null @@ -1,100 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </value> - </item> - <item> - <key> <string>_bind_names</string> </key> - <value> - <object> - <klass> - <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> - </klass> - <tuple/> - <state> - <dictionary> - <item> - <key> <string>_asgns</string> </key> - <value> - <dictionary> - <item> - <key> <string>name_container</string> </key> - <value> <string>container</string> </value> - </item> - <item> - <key> <string>name_context</string> </key> - <value> <string>context</string> </value> - </item> - <item> - <key> <string>name_m_self</string> </key> - <value> <string>script</string> </value> - </item> - <item> - <key> <string>name_subpath</string> </key> - <value> <string>traverse_subpath</string> </value> - </item> - </dictionary> - </value> - </item> - </dictionary> - </state> - </object> - </value> - </item> - <item> - <key> <string>_body</string> </key> - <value> <string encoding="cdata"><![CDATA[ - -software_instance = state_change[\'object\']\n -service_relative_url = software_instance.portal_preferences.\\\n - getPreferredInstanceHostingResource()\n -need_to_create_packing_list = False\n -try:\n - instance_setup_line = context.SoftwareInstance_getInstanceSetupPackingListLine(state_change)\n -except ValueError:\n - pass\n -else:\n - if instance_setup_line.getSimulationState() == \'stopped\':\n - try:\n - sale_packing_list_line = context.SoftwareInstance_getInstanceHostingPackingListLine(state_change)\n - except ValueError:\n - need_to_create_packing_list = True\n - else:\n - if sale_packing_list_line.getSimulationState() == \'stopped\':\n - # previously it was still in stop in progress state, now it shall be started again\n - sale_packing_list_line.getParentValue().deliver()\n - if sale_packing_list_line.getSimulationState() == \'delivered\':\n - need_to_create_packing_list = True\n -\n -portal = context.getPortalObject()\n -if need_to_create_packing_list:\n - tag = "%s_startInProgress" % software_instance.getUid()\n - if (portal.portal_activities.countMessageWithTag(tag) > 0):\n - raise ValueError("Software Instance is currently being started.")\n - # lock software instance in transaction\n - software_instance.serialize()\n - sale_packing_list = context.SoftwareInstance_createSalePackingList(state_change, service_relative_url, tag)\n - sale_packing_list.confirm(activate_kw={\'tag\':tag})\n - - -]]></string> </value> - </item> - <item> - <key> <string>_params</string> </key> - <value> <string>state_change</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>SoftwareInstance_requestStart</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestStop.xml b/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestStop.xml deleted file mode 100644 index 5784378481171e5c8890cd6a01ecc2577c35af37..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestStop.xml +++ /dev/null @@ -1,73 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </value> - </item> - <item> - <key> <string>_bind_names</string> </key> - <value> - <object> - <klass> - <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> - </klass> - <tuple/> - <state> - <dictionary> - <item> - <key> <string>_asgns</string> </key> - <value> - <dictionary> - <item> - <key> <string>name_container</string> </key> - <value> <string>container</string> </value> - </item> - <item> - <key> <string>name_context</string> </key> - <value> <string>context</string> </value> - </item> - <item> - <key> <string>name_m_self</string> </key> - <value> <string>script</string> </value> - </item> - <item> - <key> <string>name_subpath</string> </key> - <value> <string>traverse_subpath</string> </value> - </item> - </dictionary> - </value> - </item> - </dictionary> - </state> - </object> - </value> - </item> - <item> - <key> <string>_body</string> </key> - <value> <string>try:\n - packing_list_line = context.SoftwareInstance_getInstanceHostingPackingListLine(state_change)\n -except ValueError:\n - pass\n -else:\n - packing_list = packing_list_line.getParentValue()\n - packing_list.stop()\n -</string> </value> - </item> - <item> - <key> <string>_params</string> </key> - <value> <string>state_change</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>SoftwareInstance_requestStop</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestStopIfNeeded.xml b/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestStopIfNeeded.xml deleted file mode 100644 index a3a5ffe94458eb7d82d5ed385998bdb4f14282e7..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestStopIfNeeded.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </value> - </item> - <item> - <key> <string>_bind_names</string> </key> - <value> - <object> - <klass> - <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> - </klass> - <tuple/> - <state> - <dictionary> - <item> - <key> <string>_asgns</string> </key> - <value> - <dictionary> - <item> - <key> <string>name_container</string> </key> - <value> <string>container</string> </value> - </item> - <item> - <key> <string>name_context</string> </key> - <value> <string>context</string> </value> - </item> - <item> - <key> <string>name_m_self</string> </key> - <value> <string>script</string> </value> - </item> - <item> - <key> <string>name_subpath</string> </key> - <value> <string>traverse_subpath</string> </value> - </item> - </dictionary> - </value> - </item> - </dictionary> - </state> - </object> - </value> - </item> - <item> - <key> <string>_body</string> </key> - <value> <string>try:\n - packing_list_line = context.SoftwareInstance_getInstanceHostingPackingListLine(state_change)\n -except ValueError:\n - pass\n -else:\n - packing_list = packing_list_line.getParentValue()\n - if packing_list.getPortalObject().portal_workflow.isTransitionPossible(packing_list, \'stop\'):\n - packing_list.stop()\n -</string> </value> - </item> - <item> - <key> <string>_params</string> </key> - <value> <string>state_change</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>SoftwareInstance_requestStopIfNeeded</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestUpdate.xml b/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestUpdate.xml deleted file mode 100644 index 216d96f8361c36190e77e2af0aeafb7221293a90..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestUpdate.xml +++ /dev/null @@ -1,118 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </value> - </item> - <item> - <key> <string>_bind_names</string> </key> - <value> - <object> - <klass> - <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> - </klass> - <tuple/> - <state> - <dictionary> - <item> - <key> <string>_asgns</string> </key> - <value> - <dictionary> - <item> - <key> <string>name_container</string> </key> - <value> <string>container</string> </value> - </item> - <item> - <key> <string>name_context</string> </key> - <value> <string>context</string> </value> - </item> - <item> - <key> <string>name_m_self</string> </key> - <value> <string>script</string> </value> - </item> - <item> - <key> <string>name_subpath</string> </key> - <value> <string>traverse_subpath</string> </value> - </item> - </dictionary> - </value> - </item> - </dictionary> - </state> - </object> - </value> - </item> - <item> - <key> <string>_body</string> </key> - <value> <string encoding="cdata"><![CDATA[ - -from Products.DCWorkflow.DCWorkflow import ValidationFailed\n -from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery\n -\n -software_instance = state_change[\'object\']\n -portal = software_instance.getPortalObject()\n -\n -if software_instance.SoftwareInstance_getStatus() == \'Destroyed\':\n - raise ValidationFailed, "%s state is %s" % (software_instance.getRelativeUrl(), software_instance.SoftwareInstance_getStatus())\n -\n -# avoid conflicting with "in progress" update tasks\n -tag_list = ["%s_destroyInProgress" % software_instance.getUid(), "%s_startInProgress" % software_instance.getUid()]\n -for tag in tag_list:\n - if (portal.portal_activities.countMessageWithTag(tag) > 0):\n - # do nothing if something is progress\n - return\n -portal_preferences = portal.portal_preferences\n -\n -update_resource_uid = portal.restrictedTraverse(portal_preferences.getPreferredInstanceUpdateResource()).getUid()\n -setup_resource_uid = portal.restrictedTraverse(portal_preferences.getPreferredInstanceSetupResource()).getUid()\n -hosting_resource_uid = portal.restrictedTraverse(portal_preferences.getPreferredInstanceHostingResource()).getUid()\n -\n -service_uid_state_mapping = {\n - setup_resource_uid: [\'stopped\'],\n - hosting_resource_uid: [\'started\', \'delivered\'],\n - update_resource_uid: [\'started\', \'stopped\', \'delivered\'],\n -}\n -try:\n - previous_packing_list_line = context.SoftwareInstance_getInstancePackingListLine(state_change)\n -except ValueError:\n - # no packing list yet, no need to update\n - return\n -\n -resource_uid = previous_packing_list_line.getResourceUid()\n -if resource_uid == hosting_resource_uid:\n - if previous_packing_list_line.getSimulationState() not in service_uid_state_mapping[hosting_resource_uid]:\n - return\n -elif resource_uid == setup_resource_uid:\n - if previous_packing_list_line.getSimulationState() not in service_uid_state_mapping[setup_resource_uid]:\n - return\n -elif resource_uid == update_resource_uid:\n - if previous_packing_list_line.getSimulationState() not in service_uid_state_mapping[update_resource_uid]:\n - return\n -else:\n - # not "supported" resource, eg. cleanup\n - return\n -\n -# time to create packing list\n -context.SoftwareInstance_createSalePackingList(state_change, portal_preferences.getPreferredInstanceUpdateResource()).confirm()\n - - -]]></string> </value> - </item> - <item> - <key> <string>_params</string> </key> - <value> <string>state_change</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>SoftwareInstance_requestUpdate</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/master/bt5/vifib_base/bt/revision b/master/bt5/vifib_base/bt/revision index 9ec873d37d5000c0c6f4879ac80d965e3cbd6ac1..27384974685c11f34eb44981eec6c97f035971e8 100644 --- a/master/bt5/vifib_base/bt/revision +++ b/master/bt5/vifib_base/bt/revision @@ -1 +1 @@ -438 \ No newline at end of file +439 \ No newline at end of file diff --git a/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/interactions/change_instance_promise_state.xml b/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/interactions/change_instance_promise_state.xml index c1ec147622fa188cc41fbfa962f18ee3b56d8fb3..9febdbb5b4e5181b8a47e9318c6d93f035c14048 100644 --- a/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/interactions/change_instance_promise_state.xml +++ b/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/interactions/change_instance_promise_state.xml @@ -59,6 +59,7 @@ <string>requestStart</string> <string>requestStop</string> <string>requestDestroy</string> + <string>allocatePartition</string> </list> </value> </item> diff --git a/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseState.xml b/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseState.xml index f9aecfe94e00812a4d8d923f700ec7f6cb2e1097..af1aadc9274a4ab0b69bbc91ad47b68ac4ad23e8 100644 --- a/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseState.xml +++ b/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseState.xml @@ -67,6 +67,12 @@ assert state in [started, stopped, destroyed]\n # Get all needed services\n setup_service_relative_url = portal.portal_preferences.getPreferredInstanceSetupResource()\n setup_service = portal.restrictedTraverse(setup_service_relative_url)\n +hosting_service_relative_url = portal.portal_preferences.getPreferredInstanceHostingResource()\n +hosting_service = portal.restrictedTraverse(hosting_service_relative_url)\n +cleanup_service_relative_url = portal.portal_preferences.getPreferredInstanceCleanupResource()\n +cleanup_service = portal.restrictedTraverse(cleanup_service_relative_url)\n +update_service_relative_url = portal.portal_preferences.getPreferredInstanceUpdateResource()\n +update_service = portal.restrictedTraverse(update_service_relative_url)\n # Get software release\n software_release_document = portal.portal_catalog.getResultValue(\n portal_type=\'Software Release\',\n @@ -121,7 +127,113 @@ if (partition is None):\n hosting_subscription.getRelativeUrl()]\n sale_order_line.edit(aggregate_list=aggregate_list)\n else:\n - raise NotImplementedError\n + assert delivery is not None\n +\n + if (delivery.getPortalType() == "Sale Order"):\n + if (state == stopped):\n + # Try to find the setup packing list created from the open order to\n + # associate it instead of the sale order\n + packing_list = delivery.getCausalityRelatedValue(portal_type="Sale Packing List")\n + if (packing_list is not None):\n + instance.edit(causality_value=packing_list)\n + else:\n + # Create a new packing list from scratch\n +\n + packing_list_module = portal.getDefaultModule(portal_type=\'Sale Packing List\')\n + packing_list = packing_list_module.newContent(\n + portal_type=\'Sale Packing List\',\n + specialise=delivery.getSpecialise() or delivery.getCausalityValue().getSpecialise(),\n + destination=delivery.getDestination(),\n + destination_section=delivery.getDestinationSection(),\n + destination_decision=delivery.getDestinationDecision(),\n + source=delivery.getSource(),\n + source_section=delivery.getSourceSection(),\n + price_currency=delivery.getPriceCurrency(),\n + start_date=DateTime())\n +\n + if (state == started):\n + service_relative_url = hosting_service_relative_url\n + service = hosting_service\n + elif (state == destroyed):\n + service_relative_url = cleanup_service_relative_url\n + service = cleanup_service\n +\n + packing_list_line = packing_list.newContent(\n + portal_type=\'Sale Packing List Line\',\n + resource=service_relative_url,\n + quantity=service.getQuantity(),\n + aggregate_list=delivery.getAggregateList(),\n + # XXX Hardcode price on service\n + price=service.getSaleSupplyLineBasePrice(),\n + )\n +\n + instance.edit(causality_value=packing_list)\n +\n + if (state == started):\n + packing_list.confirm()\n + elif (state == destroyed):\n + packing_list.confirm()\n +\n + else:\n + assert delivery.getPortalType() == "Sale Packing List"\n + line_list = delivery.contentValues(portal_type="Sale Packing List Line")\n + assert len(line_list) == 1\n + line = line_list[0]\n + service_relative_url = line.getResource()\n +\n + def letsclone(service_relative_url):\n + new_delivery = delivery.Base_createCloneDocument(batch_mode=1)\n + new_delivery.edit(start_date=DateTime(), stop_date=DateTime())\n + new_delivery.contentValues(portal_type="Sale Packing List Line")[0].edit(resource=service_relative_url)\n + return new_delivery\n +\n + if (service_relative_url == setup_service_relative_url):\n + if (state == started):\n + new_delivery = letsclone(hosting_service_relative_url)\n + new_delivery.start()\n + instance.edit(causality_value=new_delivery)\n + elif (state == stopped):\n + pass\n + elif (state == destroyed):\n + new_delivery = letsclone(cleanup_service_relative_url)\n + new_delivery.confirm()\n + instance.edit(causality_value=new_delivery)\n + else:\n + raise NotImplementedError\n +\n + elif (service_relative_url == hosting_service_relative_url):\n + if (state == started):\n + if (delivery.getSimulationState() == \'stopped\'):\n + delivery.deliver()\n + new_delivery = letsclone(update_service_relative_url)\n + new_delivery.confirm()\n + instance.edit(causality_value=new_delivery)\n + elif (state == stopped):\n + delivery.edit(stop_date=DateTime())\n + delivery.stop()\n + elif (state == destroyed):\n + new_delivery = letsclone(cleanup_service_relative_url)\n + new_delivery.confirm()\n + instance.edit(causality_value=new_delivery)\n + else:\n + raise NotImplementedError\n +\n + elif (service_relative_url == cleanup_service_relative_url):\n + raise NotImplementedError, "Not update should be allowed"\n +\n + elif (service_relative_url == update_service_relative_url):\n + if (state == started):\n + pass\n + elif (state == stopped):\n + pass\n + elif (state == destroyed):\n + new_delivery = letsclone(cleanup_service_relative_url)\n + new_delivery.confirm()\n + instance.edit(causality_value=new_delivery)\n + else:\n + raise NotImplementedError\n + else:\n + raise NotImplementedError\n </string> </value> </item> <item> diff --git a/master/bt5/vifib_slapos_accounting/bt/revision b/master/bt5/vifib_slapos_accounting/bt/revision index d8263ee9860594d2806b0dfd1bfd17528b0ba2a4..e440e5c842586965a7fb77deda2eca68612b1f53 100644 --- a/master/bt5/vifib_slapos_accounting/bt/revision +++ b/master/bt5/vifib_slapos_accounting/bt/revision @@ -1 +1 @@ -2 \ No newline at end of file +3 \ No newline at end of file