Commit 83e731d9 authored by Łukasz Nowak's avatar Łukasz Nowak

Switch to delivery-less allocation.

parent bd4bbde2
###############################################################################
#
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from AccessControl.SecurityManagement import getSecurityManager, \
setSecurityManager, newSecurityManager
from AccessControl import Unauthorized
def restrictMethodAsShadowUser(self, shadow_document=None, callable_object=None,
argument_list=None, argument_dict=None):
"""
Restrict the security access of a method to the unaccessible shadow user
associated to the current user.
"""
if argument_list is None:
argument_list = []
if argument_dict is None:
argument_dict = {}
if shadow_document is None or callable_object is None:
raise TypeError('shadow_document and callable_object cannot be None')
relative_url = shadow_document.getRelativeUrl()
if shadow_document.getPortalType() not in ('Person', 'Software Instance',
'Computer'):
raise Unauthorized("%s portal type %r is not supported" % (relative_url,
shadow_document.getPortalType()))
else:
# Switch to the shadow user temporarily, so that the behavior would not
# change even if this method is invoked by random users.
acl_users = shadow_document.getPortalObject().acl_users
reference = shadow_document.getReference()
if reference is None:
raise Unauthorized('%r is not configured' % relative_url)
real_user = acl_users.getUserById(reference)
if real_user is None:
raise Unauthorized('%s is not loggable user' % relative_url)
sm = getSecurityManager()
shadow_user = acl_users.getUserById('SHADOW-' + reference)
if shadow_user is None:
raise Unauthorized('Shadow of %s is not loggable user' % relative_url)
newSecurityManager(None, shadow_user)
try:
return callable_object(*argument_list, **argument_dict)
finally:
# Restore the original user.
setSecurityManager(sm)
......@@ -8,11 +8,13 @@
<dictionary>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_orderPlannedSaleOrder</string> </value>
<value> <string>Alarm_allocateInstance</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Orders planned Sale Orders.</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>enabled</string> </key>
......@@ -20,7 +22,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>order_planned_sale_order</string> </value>
<value> <string>slapos_allocate_instance</string> </value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
......@@ -87,7 +89,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Order planned Sale Orders</string> </value>
<value> <string>Allocates instances</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -51,13 +51,15 @@
<item>
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
setup_service = portal.portal_preferences.getPreferredInstanceSetupResource()\n
\n
select_dict= {\'default_aggregate_uid\': None}\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Sale Order Line\',\n
default_resource_uid=portal.restrictedTraverse(setup_service).getUid(),\n
simulation_state="ordered",\n
method_id=\'SaleOrderLine_tryToAllocatePartition\',\n
portal_type=(\'Slave Instance\', \'Software Instance\'),\n
validation_state=\'validated\',\n
default_aggregate_uid=None,\n
select_dict=select_dict,\n
left_join_list=select_dict.keys(),\n
\n
method_id=\'SoftwareInstance_tryToAllocatePartition\',\n
packet_size=1, # Separate calls to many transactions\n
activate_kw={\'tag\': tag}\n
)\n
......@@ -71,7 +73,7 @@ context.activate(after_tag=tag).getId()\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_confirmOrderedSaleOrder</string> </value>
<value> <string>Alarm_allocateInstance</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -53,7 +53,7 @@
<value> <string encoding="cdata"><![CDATA[
import random\n
open_sale_order = context\n
person = context\n
\n
computer_partition = None\n
query_kw = {\n
......@@ -66,8 +66,8 @@ if software_instance_portal_type == "Slave Instance":\n
elif software_instance_portal_type == "Software Instance":\n
query_kw[\'free_for_request\'] = 1\n
else:\n
raise NotImplementedError, "Unknown portal type %s" % \\\n
software_instance_portal_type \n
raise NotImplementedError("Unknown portal type %s"%\n
software_instance_portal_type)\n
\n
# support SLA\n
\n
......@@ -144,8 +144,8 @@ if test_mode:\n
SQL_WINDOW_SIZE = 50\n
\n
# fetch at mot 50 random Computer Partitions, and check if they are ok\n
isTransitionPossible = open_sale_order.getPortalObject().portal_workflow.isTransitionPossible\n
result_count = open_sale_order.portal_catalog.countResults(**query_kw)[0][0]\n
isTransitionPossible = person.getPortalObject().portal_workflow.isTransitionPossible\n
result_count = person.portal_catalog.countResults(**query_kw)[0][0]\n
offset = max(0, result_count-1)\n
if offset >= SQL_WINDOW_SIZE:\n
limit = (random.randint(0, offset), SQL_WINDOW_SIZE)\n
......@@ -154,7 +154,7 @@ else:\n
\n
for computer_partition_candidate in context.portal_catalog(\n
limit=limit, **query_kw):\n
computer_partition_candidate = computer_partition_candidate.getObject() \n
computer_partition_candidate = computer_partition_candidate.getObject()\n
if software_instance_portal_type == "Software Instance":\n
# Check if the computer partition can be marked as busy\n
if isTransitionPossible(computer_partition_candidate, \'mark_busy\'):\n
......@@ -183,7 +183,7 @@ return computer_partition.getRelativeUrl()\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>OpenSaleOrder_findPartition</string> </value>
<value> <string>Person_findPartition</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -72,17 +72,9 @@ return True\n
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Delivery_isDestinationSectionAllowedToRequest</string> </value>
<value> <string>Person_isAllowedToAllocate</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -12,11 +12,11 @@
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>VifibSecurity</string> </value>
<value> <string>SlapOSCloudSecurity</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>OpenSaleOrder_restrictMethodAsShadowUser</string> </value>
<value> <string>Person_restrictMethodAsShadowUser</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -50,49 +50,60 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from DateTime import DateTime\n
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
<value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from zExceptions import Unauthorized\n
\n
if context.getPortalType() not in (\'Software Instance\', \'Slave Instance\'):\n
raise TypeError(\'%s is not supported\' % context.getPortalType())\n
\n
def markHistory(document, comment):\n
portal_workflow = document.portal_workflow\n
last_workflow_item = portal_workflow.getInfoFor(ob=document, \n
name=\'history\', wf_id=\'edit_workflow\')[-1]\n
if last_workflow_item[\'comment\'] != comment:\n
last_workflow_item = portal_workflow.getInfoFor(ob=document,\n
name=\'comment\', wf_id=\'edit_workflow\')\n
if last_workflow_item != comment:\n
portal_workflow.doActionFor(document, action=\'edit_action\', comment=comment)\n
\n
state = context.getSimulationState()\n
portal = context.getPortalObject()\n
order = context.getParentValue()\n
if state in [\'planned\', \'ordered\']:\n
instance = context.getAggregateValue(portal_type=[\'Software Instance\', \'Slave Instance\'])\n
instance_software_release_url = instance.getUrlString()\n
line_software_release_document = context.getAggregateValue(portal_type=\'Software Release\')\n
line_software_release_url = \'\'\n
if line_software_release_document is not None:\n
line_software_release_url = line_software_release_document.getUrlString()\n
def assignComputerPartition(software_instance):\n
computer_partition = software_instance.getAggregateValue(\n
portal_type="Computer Partition")\n
if computer_partition is None:\n
hosting_subscription = software_instance.getSpecialiseValue(\n
portal_type=\'Hosting Subscription\')\n
person = hosting_subscription.getDestinationSectionValue(portal_type=\'Person\')\n
if not person.Person_isAllowedToAllocate():\n
raise Unauthorized(\'Allocation disallowed\')\n
\n
software_release_document = context.Base_getSoftwareReleaseDocument(instance_software_release_url)\n
computer_partition_relative_url = person.Person_restrictMethodAsShadowUser(\n
shadow_document=person,\n
callable_object=person.Person_findPartition,\n
argument_list=[software_instance.getUrlString(), software_instance.getSourceReference(),\n
software_instance.getPortalType(), software_instance.getSlaXmlAsDict()])\n
return computer_partition_relative_url\n
return (None, None)\n
\n
if line_software_release_url == \'\' or \\\n
line_software_release_url != instance_software_release_url:\n
if software_release_document is not None:\n
# update\n
aggregate_value_list = [q for q in context.getAggregateValueList() if q.getPortalType() != \'Software Release\']\n
aggregate_value_list.append(software_release_document)\n
context.setAggregateValueList(aggregate_value_list)\n
if context.getSimulationState() == \'planned\':\n
context.getParentValue().order(comment=\'Associated Software Release with %r\' % software_release_document.getUrlString())\n
else:\n
markHistory(context.getParentValue(), comment=\'Updated Software Release with %r\' % software_release_document.getUrlString())\n
return True\n
else:\n
return False\n
else:\n
# nothing to do, all asserted\n
return True\n
software_instance = context\n
if software_instance.getValidataionState() != \'validated\' \\\n
or software_instance.getSlapState() not in (\'start_requested\', \'stop_requested\') \\\n
or software_instance.getAggregateValue(portal_type=\'Computer Partition\') is not None:\n
return\n
\n
return False\n
try:\n
computer_partition_url = assignComputerPartition(software_instance)\n
except ValueError:\n
# It was not possible to find free Computer Partition\n
markHistory(software_instance, \'Allocation failed: no free Computer Partition\')\n
except Unauthorized, e:\n
# user has bad balance\n
markHistory(software_instance, \'Allocation failed: %s\' % e)\n
else:\n
if computer_partition_url is not None:\n
try:\n
software_instance.Base_checkConsistency()\n
except ValidationFailed:\n
# order not ready yet\n
markHistory(software_instance, \'Allocation failed: consistency failed\')\n
else:\n
software_instance.allocatePartition(computer_partition_url=computer_partition_url)\n
</string> </value>
</item>
<item>
......@@ -101,7 +112,7 @@ return False\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleOrderLine_tryToAssociateSoftwareRelease</string> </value>
<value> <string>SoftwareInstance_tryToAllocatePartition</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -59,7 +59,7 @@ kwargs = state_change.kwargs\n
# Required args\n
# Raise TypeError if all parameters are not provided\n
try:\n
computer_partition_url = kwargs[\'computer_partition\']\n
computer_partition_url = kwargs[\'computer_partition_url\']\n
except KeyError:\n
raise TypeError, "RequestedInstance_allocatePartition takes exactly 1 argument"\n
\n
......
102
\ No newline at end of file
103
\ No newline at end of file
SlapOSCloudSecurity
\ No newline at end of file
......@@ -4,5 +4,6 @@ computer_module/template_computer/**
hosting_subscription_module/template_hosting_subscription
person_module/template_member
person_module/template_member/**
portal_alarms/slapos_allocate_instance
software_installation_module/template_software_installation
software_instance_module/template_software_instance
\ No newline at end of file
507
\ No newline at end of file
508
\ No newline at end of file
......@@ -29,37 +29,6 @@ from AccessControl.SecurityManagement import getSecurityManager, \
setSecurityManager, newSecurityManager
from AccessControl import Unauthorized
def restrictMethodAsShadowUser(self, open_order=None, callable_object=None,
argument_list=None, argument_dict=None):
"""
Restrict the security access of a method to the unaccessible shadow user
associated to the current user.
"""
if argument_list is None:
argument_list = []
if argument_dict is None:
argument_dict = {}
if open_order is None or callable_object is None:
raise TypeError('open_order and callable_object cannot be None')
relative_url = open_order.getRelativeUrl()
if open_order.getPortalType() != 'Open Sale Order':
raise Unauthorized("%s is not an Open Sale Order" % relative_url)
else:
# Check that open order is the validated one for the current user
if open_order.getValidationState() != 'validated':
raise Unauthorized('Open Sale Order %s is not validated.' % relative_url)
acl_users = open_order.getPortalObject().acl_users
# Switch to the shadow user temporarily, so that the behavior would not
# change even if this method is invoked by random users.
sm = getSecurityManager()
newSecurityManager(None, acl_users.getUserById(open_order.getReference()))
try:
return callable_object(*argument_list, **argument_dict)
finally:
# Restore the original user.
setSecurityManager(sm)
def SoftwareInstance_bangAsSelf(self, relative_url=None, reference=None,
comment=None):
"""Call bang on self."""
......
525
\ No newline at end of file
526
\ No newline at end of file
185
\ No newline at end of file
186
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Alarm" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_confirmOrderedSaleOrder</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Automatically confirm order Sale Order generated from Hosting web site (for demo)</string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>confirm_ordered_sale_order</string> </value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute_frequency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>periodicity_month</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_day</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1288051200.0</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_week</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>sense_method_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Confirm ordered Sale Order</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -31,10 +31,6 @@
<type>Sale Invoice Transaction</type>
<workflow>slap_interaction_workflow</workflow>
</chain>
<chain>
<type>Sale Order</type>
<workflow>slap_interaction_workflow</workflow>
</chain>
<chain>
<type>Sale Packing List</type>
<workflow>slap_interaction_workflow</workflow>
......
<?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>portal = context.getPortalObject()\n
setup_service = portal.portal_preferences.getPreferredInstanceSetupResource()\n
\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Sale Order Line\',\n
default_resource_uid=portal.restrictedTraverse(setup_service).getUid(),\n
simulation_state="planned",\n
method_id=\'SaleOrderLine_tryToAssociateSoftwareRelease\',\n
packet_size=1, # Separate calls to many transactions\n
activate_kw={\'tag\': tag}\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>tag, fixit, params</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_orderPlannedSaleOrder</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>from DateTime import DateTime\n
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from zExceptions import Unauthorized\n
\n
def markHistory(document, comment):\n
portal_workflow = document.portal_workflow\n
last_workflow_item = portal_workflow.getInfoFor(ob=document, \n
name=\'comment\', wf_id=\'edit_workflow\')\n
if last_workflow_item != comment:\n
portal_workflow.doActionFor(document, action=\'edit_action\', comment=comment)\n
\n
def assignComputerPartition(order):\n
portal = context.getPortalObject()\n
\n
setup_service_relative_url = order.portal_preferences.getPreferredInstanceSetupResource()\n
isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
\n
instance_portal_type_list = ["Software Instance","Slave Instance"]\n
for order_line in order.getMovementList():\n
if order_line.getResource() == setup_service_relative_url:\n
computer_partition = order_line.getAggregateValue(portal_type="Computer Partition")\n
if computer_partition is None:\n
if not order.Delivery_isDestinationSectionAllowedToRequest():\n
raise Unauthorized(\'Request disallowed\')\n
software_release = order_line.getAggregateValue(portal_type="Software Release")\n
software_instance = order_line.getAggregateValue(portal_type=instance_portal_type_list)\n
\n
hosting_subscription = order_line.getAggregateValue(portal_type="Hosting Subscription")\n
open_order_line = portal.portal_catalog.getResultValue(\n
portal_type="Open Sale Order Line",\n
validation_state="validated",\n
aggregate_relative_url=hosting_subscription.getRelativeUrl(),\n
destination_section_relative_url=order.getDestinationSection())\n
if open_order_line is not None:\n
open_order = open_order_line.getParentValue()\n
computer_partition_relative_url = open_order.OpenSaleOrder_restrictMethodAsShadowUser(\n
open_order=open_order,\n
callable_object=open_order.OpenSaleOrder_findPartition,\n
argument_list=[software_release.getUrlString(), software_instance.getSourceReference(),\n
software_instance.getPortalType(), software_instance.getSlaXmlAsDict()])\n
order_line.edit(\n
aggregate_list=order_line.getAggregateList()+[computer_partition_relative_url])\n
return (software_instance, computer_partition_relative_url)\n
else:\n
markHistory(order, \'Not confirmed: no open order line found.\')\n
return (None, None)\n
\n
sale_order = context.getParentValue()\n
if sale_order.getSimulationState() == \'ordered\':\n
if not context.SaleOrderLine_tryToAssociateSoftwareRelease():\n
# support changing software release for not instantiated orders\n
markHistory(sale_order, \'Software Release not associated.\')\n
try:\n
software_instance, computer_partition = assignComputerPartition(sale_order)\n
except ValueError:\n
# It was not possible to find free Computer Partition\n
markHistory(sale_order, \'Not confirmed: no free Computer Partition\')\n
except Unauthorized, e:\n
# user has bad balance\n
markHistory(sale_order, \'Not confirmed: %s\' % e)\n
else:\n
if computer_partition is not None:\n
try:\n
sale_order.Base_checkConsistency()\n
except ValidationFailed:\n
# order not ready yet\n
markHistory(sale_order, \'Not confirmed: consistency failed\')\n
else:\n
sale_order.setStopDate(DateTime())\n
sale_order.confirm()\n
software_instance.allocatePartition(computer_partition=computer_partition)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleOrderLine_tryToAllocatePartition</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -21,9 +21,7 @@
<item>
<key> <string>activate_script_name</string> </key>
<value>
<list>
<string>SaleOrder_triggerAlarm</string>
</list>
<tuple/>
</value>
</item>
<item>
......@@ -50,14 +48,13 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleOrder_reindexObject</string> </value>
<value> <string>SoftwareInstance_validate</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>reindexObject</string>
<string>recursiveReindexObject</string>
<string>validate</string>
</list>
</value>
</item>
......@@ -69,7 +66,8 @@
<key> <string>portal_type_filter</string> </key>
<value>
<list>
<string>Sale Order</string>
<string>Slave Instance</string>
<string>Software Instance</string>
</list>
</value>
</item>
......
......@@ -50,19 +50,12 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>sale_order = state_change[\'object\']\n
<value> <string>software_instance = state_change[\'object\']\n
\n
portal = sale_order.getPortalObject()\n
portal = software_instance.getPortalObject()\n
\n
simulation_state = sale_order.getSimulationState()\n
alarm = None\n
if simulation_state == \'planned\':\n
alarm = portal.portal_alarms.order_planned_sale_order\n
elif simulation_state == \'ordered\':\n
alarm = portal.portal_alarms.confirm_ordered_sale_order\n
\n
if alarm is not None:\n
context.Alarm_safeTrigger(alarm)\n
if software_instance.getValidationState() == \'validated\':\n
context.Alarm_safeTrigger(portal.portal_alarms.slapos_allocate_instance)\n
</string> </value>
</item>
<item>
......@@ -71,7 +64,7 @@ if alarm is not None:\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleOrder_triggerAlarm</string> </value>
<value> <string>SoftwareInstance_triggerAlarm</string> </value>
</item>
</dictionary>
</pickle>
......
855
\ No newline at end of file
856
\ No newline at end of file
portal_alarms/cleanup_active_process
portal_alarms/confirm_ordered_sale_order
portal_alarms/confirm_planned_sale_invoice_transaction
portal_alarms/deliver_subscription_sale_packing_list
portal_alarms/free_computer_partition
portal_alarms/garbage_collect_destroyed_root_tree
portal_alarms/order_planned_sale_order
portal_alarms/stop_confirmed_sale_invoice_transaction
portal_alarms/vifib_assert_hosting_subscription_predecessor
portal_alarms/vifib_bang_selenium_tester_instance
......
......@@ -6,7 +6,6 @@ Open Sale Order | slap_interaction_workflow
Person | slap_interaction_workflow
Purchase Packing List | slap_interaction_workflow
Sale Invoice Transaction | slap_interaction_workflow
Sale Order | slap_interaction_workflow
Sale Packing List Line | slap_interaction_workflow
Sale Packing List | slap_interaction_workflow
Slave Instance | slap_interaction_workflow
......
......@@ -408,11 +408,7 @@ class InstancePublisher(GenericPublisher):
portal_type="Person")
else:
raise NotImplementedError, "Can not get Person document"
open_order = self.portal_catalog.getResultValue(
portal_type='Open Sale Order',
default_destination_decision_uid=user.getUid(),
validation_state='validated')
result = open_order.OpenSaleOrder_findPartition(
user.Person_findPartition(
self.jbody['software_release'],
self.jbody['software_type'],
('Software Instance', 'Slave Instance')[int(self.jbody['slave'])],
......
22
\ No newline at end of file
23
\ No newline at end of file
......@@ -105,7 +105,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for owner
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -122,7 +122,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# fail to instantiate for someone else
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
CheckNoRelatedSalePackingListLineForSoftwareInstance
Logout
......@@ -135,7 +135,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for owner
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -204,7 +204,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for owner
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -221,7 +221,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for friend
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -238,7 +238,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# fail to instantiate for someone else
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
CheckNoRelatedSalePackingListLineForSoftwareInstance
Logout
......@@ -251,7 +251,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for friend
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -307,7 +307,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for owner
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -324,7 +324,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for someone else
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -379,7 +379,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# fail to instantiate for owner
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
CheckNoRelatedSalePackingListLineForSoftwareInstance
Logout
......@@ -429,7 +429,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# fail to instantiate for owner
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
CheckNoRelatedSalePackingListLineForSoftwareInstance
Logout
......@@ -481,7 +481,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for someone else
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -499,7 +499,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
CheckSoftwareInstanceAndRelatedComputerPartition
CheckRequestedSoftwareInstanceAndRelatedComputerPartition
......@@ -530,7 +530,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for someone else
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -597,7 +597,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for friend
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -617,7 +617,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for someone else
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -653,7 +653,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
CheckSoftwareInstanceAndRelatedComputerPartition
CheckRequestedSoftwareInstanceAndRelatedComputerPartition
......@@ -684,7 +684,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for someone else
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -728,7 +728,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for someone else
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -803,7 +803,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for owner
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Tic
SetSelectedComputerPartition
......@@ -822,7 +822,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for someone else
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......
......@@ -26,7 +26,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
root_software_instance.requestInstance(software_title=S1,
**common_kw)
self.stepTic()
self.stepCallConfirmOrderedSaleOrderAlarm()
self.stepCallSlaposAllocateInstanceAlarm()
self.stepTic()
S1_instance = self.portal.portal_catalog.getResultValue(
......@@ -34,13 +34,13 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
S1_instance.requestInstance(software_title=S2, **common_kw)
self.stepTic()
S1_instance.requestInstance(software_title=S3, **common_kw)
self.stepCallConfirmOrderedSaleOrderAlarm()
self.stepCallSlaposAllocateInstanceAlarm()
self.stepTic()
root_software_instance.requestInstance(software_title=S4,
**common_kw)
self.stepTic()
self.stepCallConfirmOrderedSaleOrderAlarm()
self.stepCallSlaposAllocateInstanceAlarm()
self.stepTic()
S2_instance = self.portal.portal_catalog.getResultValue(
......@@ -379,7 +379,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
</instance>""" % sequence['computer_reference_c1'],
**common_kw)
self.stepTic()
self.stepCallConfirmOrderedSaleOrderAlarm()
self.stepCallSlaposAllocateInstanceAlarm()
self.stepTic()
self.logout()
......@@ -397,7 +397,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
</instance>""" % sequence['computer_reference_c0'],
**common_kw)
self.stepTic()
self.stepCallConfirmOrderedSaleOrderAlarm()
self.stepCallSlaposAllocateInstanceAlarm()
self.stepTic()
self.logout()
......@@ -419,7 +419,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
self.logout()
self.stepLoginDefaultUser()
self.stepCallConfirmOrderedSaleOrderAlarm()
self.stepCallSlaposAllocateInstanceAlarm()
self.stepTic()
S3_instance = self.portal.portal_catalog.getResultValue(
portal_type='Software Instance', title=S3)
......@@ -521,7 +521,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
Tic
Logout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -639,7 +639,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
software_title=S1,
**common_kw)
self.stepTic()
self.stepCallConfirmOrderedSaleOrderAlarm()
self.stepCallSlaposAllocateInstanceAlarm()
self.stepTic()
self.logout()
......@@ -764,7 +764,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
Logout
SlapLoginCurrentSoftwareInstance
Bang
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
SlapLogout
Tic
LoginTestVifibCustomer
......@@ -856,7 +856,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
RenameCurrentSoftwareInstanceDead
Tic
Bang
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
SlapLogout
......@@ -880,7 +880,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SlapLogout
......@@ -892,7 +892,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SlapLogout
......@@ -978,7 +978,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
CheckRaisesNotFoundComputerPartitionParameterDict
Tic
RequestComputerPartition
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SlapLogout
......@@ -988,7 +988,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
RenameCurrentSoftwareInstanceDead
Tic
Bang
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
SlapLogout
......@@ -1002,7 +1002,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SlapLogout
......@@ -1013,7 +1013,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SlapLogout
......@@ -1025,7 +1025,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SlapLogout
......
......@@ -14,7 +14,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
PersonRequestSoftwareInstance \
Tic \
Logout \
CallConfirmOrderedSaleOrderAlarm \
CallSlaposAllocateInstanceAlarm \
CleanTic \
CallVifibTriggerBuildAlarm \
CleanTic \
......@@ -246,7 +246,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
Logout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -350,7 +350,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
......@@ -571,7 +571,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
Logout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -692,7 +692,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
Logout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -710,7 +710,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
SlapLoginCurrentSoftwareInstance
......@@ -740,7 +740,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
SlapLoginCurrentSoftwareInstance
......@@ -859,7 +859,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
Logout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -876,7 +876,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
SlapLoginCurrentSoftwareInstance
......@@ -906,7 +906,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
SlapLoginCurrentSoftwareInstance
......@@ -1033,7 +1033,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
Logout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -1050,7 +1050,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
SlapLoginCurrentSoftwareInstance
......@@ -1121,7 +1121,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
LoginDefaultUser
SetCurrentPersonSlapRequestedSoftwareInstance
SoftwareInstanceSaleOrderLineNoPartitionFound
SoftwareInstanceFailedAllocation
Logout
SlapLoginTestVifibCustomer
......@@ -1130,7 +1130,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
SoftwareInstanceSaleOrderLineNoPartitionFound
SoftwareInstanceFailedAllocation
Logout
LoginERP5TypeTestCase
......@@ -1167,7 +1167,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
......@@ -1237,7 +1237,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
......@@ -1280,7 +1280,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
......@@ -1324,7 +1324,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Logout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -1395,7 +1395,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Logout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -1442,7 +1442,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
SlapLoginCurrentSoftwareInstance
......@@ -1585,7 +1585,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
......
......@@ -225,7 +225,7 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin
SlapLogout \
\
LoginDefaultUser \
CallConfirmOrderedSaleOrderAlarm \
CallSlaposAllocateInstanceAlarm \
Tic \
CheckComputerPartitionInstanceSetupSalePackingListDelivered \
Logout \
......@@ -255,7 +255,7 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin
SlapLogout \
\
LoginDefaultUser \
CallConfirmOrderedSaleOrderAlarm \
CallSlaposAllocateInstanceAlarm \
Tic \
SetDeliveryLineAmountEqualOne \
CheckComputerPartitionInstanceSetupSalePackingListDelivered \
......
......@@ -42,7 +42,7 @@ class TestVifibSlapComputerPartitionConnection(TestVifibSlapWebServiceMixin):
Logout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
CheckGetSetConnectionDict
......
......@@ -65,7 +65,7 @@ class TestVifibSlapComputerPartitionLock(TestVifibSlapWebServiceMixin):
\
LoginDefaultUser \
SoftwareInstanceSaleOrderConfirmRaisesUnauthorized \
CallConfirmOrderedSaleOrderAlarm \
CallSlaposAllocateInstanceAlarm \
Tic \
AssertNoComputerPartition \
Logout \
......@@ -94,7 +94,7 @@ class TestVifibSlapComputerPartitionLock(TestVifibSlapWebServiceMixin):
\
LoginDefaultUser \
SoftwareInstanceSaleOrderConfirmRaisesUnauthorized \
CallConfirmOrderedSaleOrderAlarm \
CallSlaposAllocateInstanceAlarm \
Tic \
AssertNoComputerPartition \
Logout \
......
......@@ -67,7 +67,7 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin):
Logout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......
......@@ -41,7 +41,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
......@@ -63,7 +63,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
LoginDefaultUser
SetCurrentPersonSlapRequestedSoftwareInstance
SoftwareInstanceSaleOrderLineNoPartitionFound
SoftwareInstanceFailedAllocation
Logout
LoginERP5TypeTestCase
......@@ -97,7 +97,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
......@@ -155,7 +155,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
......@@ -285,7 +285,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
......@@ -348,7 +348,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
......
......@@ -355,7 +355,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
portal_type='Sale Order Line').getAggregateValue(
portal_type='Hosting Subscription').getUid())
def stepSoftwareInstanceSaleOrderLineNoPartitionFound(self, sequence,
def stepSoftwareInstanceFailedAllocation(self, sequence,
**kw):
"""Checks that current software instance is realted only with sale order
and that no partition is found
......@@ -363,18 +363,11 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
software_instance = self.portal.portal_catalog.getResultValue(
uid=sequence['software_instance_uid'])
aggregate_value_list = software_instance.getAggregateRelatedValueList(
portal_type=[self.sale_packing_list_line_portal_type,
self.sale_order_line_portal_type])
self.assertEqual(1, len(aggregate_value_list))
self.assertTrue(self.sale_order_line_portal_type in [q.getPortalType() for\
q in aggregate_value_list])
sale_order_line = aggregate_value_list[0]
self.assertNotEqual('confirmed', sale_order_line.getSimulationState())
sale_order_line.SaleOrderLine_tryToAllocatePartition()
self.assertNotEqual('confirmed', sale_order_line.getSimulationState())
self.assertEqual(None, software_instance.getAggregateValue(
portal_type='Computer Partition'))
software_instance.SoftwareInstance_tryToAllocatePartition()
self.assertEqual(None, software_instance.getAggregateValue(
portal_type='Computer Partition'))
def stepCheckViewCurrentSoftwareInstance(self, sequence, **kw):
software_instance = self.portal.portal_catalog.getResultValue(
......@@ -1007,7 +1000,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
prepare_install_requested_computer_partition_sequence_string = \
prepare_person_requested_software_instance + """
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
CallVifibTriggerBuildAlarm
CleanTic
......@@ -1128,7 +1121,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
Tic
CheckRaisesNotFoundComputerPartitionParameterDict \
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
RequestComputerPartition \
......@@ -1146,7 +1139,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
RequestComputerPartition
......@@ -1241,7 +1234,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
Logout \
\
LoginDefaultUser \
CallConfirmOrderedSaleOrderAlarm \
CallSlaposAllocateInstanceAlarm \
CleanTic \
CallVifibExpandConfirmedSaleOrderAlarm \
CleanTic \
......@@ -1658,7 +1651,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
software_type, software_type + str(2))
self.stepLoginDefaultUser()
self.stepTic()
self.stepCallConfirmOrderedSaleOrderAlarm()
self.stepCallSlaposAllocateInstanceAlarm()
self.stepTic()
self.stepLogout()
first = slap_computer_partition.request(software_release,
......@@ -2651,17 +2644,11 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
def stepCheckSlaveInstanceNotReady(self, sequence):
slave_instance = self.portal.portal_catalog.getResultValue(
uid=sequence['software_instance_uid'])
self.assertEquals(self.slave_instance_portal_type,
slave_instance.getPortalType())
sale_order_line = slave_instance.getAggregateRelatedValue(
portal_type=self.sale_order_line_portal_type)
self.assertEquals("ordered", sale_order_line.getSimulationState())
sale_order_line.SaleOrderLine_tryToAllocatePartition()
transaction.commit()
self.assertEquals("ordered", sale_order_line.getSimulationState())
sale_packing_list_line = slave_instance.getAggregateRelatedValue(
portal_type=self.sale_packing_list_line_portal_type)
self.assertEquals(sale_packing_list_line, None)
self.assertEqual(slave_instance.getAggregateValue(
portal_type='Computer Partition'))
slave_instance.SoftwareInstance_tryToAllocatePartition()
self.assertEqual(slave_instance.getAggregateValue(
portal_type='Computer Partition'))
def stepSelectSlaveInstanceFromOneComputerPartition(self, sequence):
slave_instance = self._getSlaveInstanceFromCurrentComputerPartition(sequence)
......@@ -3258,7 +3245,7 @@ class TestVifibSlapWebService(TestVifibSlapWebServiceMixin):
Logout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......
......@@ -59,7 +59,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
Logout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Tic # in order to call real build
CheckComputerPartitionSaleOrderAggregatedList
......@@ -92,7 +92,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
Logout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
CheckSlaveInstanceNotReady
Logout
......@@ -118,7 +118,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Logout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
......@@ -149,7 +149,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SlapLogout
LoginTestVifibCustomer
......@@ -183,7 +183,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
SetSoftwareTitleRandom
PersonRequestSlaveInstance
Tic
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SlapLoginCurrentComputer
SoftwareInstanceAvailable
......@@ -216,13 +216,13 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
SetSoftwareTitleRandom
PersonRequestSoftwareInstance
CleanTic
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
LoginTestVifibCustomer
SetSoftwareTitleRandom
PersonRequestSlaveInstance
Tic
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SlapLoginCurrentComputer
SoftwareInstanceAvailable
......@@ -250,7 +250,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
SetSoftwareTitleRandom
PersonRequestSlaveInstance
Tic
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
CheckSlaveInstanceNotReady
Logout
......@@ -280,7 +280,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
SetSoftwareTitleRandom
PersonRequestSlaveInstance
Tic
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
CheckSlaveInstanceReady
CheckSlaveInstanceAllocationWithTwoDifferentSoftwareInstance
......@@ -307,7 +307,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
SetSoftwareTitleRandom
PersonRequestSlaveInstance
Tic
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
""" + self.prepare_published_software_release + """
Tic
......@@ -323,14 +323,14 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
SetSoftwareTitleRandom
PersonRequestSoftwareInstance
CleanTic
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SelectDifferentSoftwareReleaseUri
LoginTestVifibCustomer
SetSoftwareTitleRandom
PersonRequestSlaveInstance
Tic
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
CheckSlaveInstanceAssociationWithSoftwareInstance
SlapLogout
......@@ -362,7 +362,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
CheckTwoSlaveInstanceRequest
SlapLogout
......@@ -395,7 +395,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SlapLogout
SlapLoginCurrentComputer
......@@ -441,7 +441,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SlapLogout
SlapLoginCurrentComputer
......@@ -493,7 +493,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
SlapLoginCurrentComputer
......@@ -545,7 +545,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
LoginTestVifibCustomer
RequestSoftwareInstanceDestroy
......@@ -575,7 +575,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SlapLogout
LoginAsCustomerA
......@@ -584,7 +584,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SlapLogout
LoginTestVifibCustomer
......@@ -615,7 +615,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SlapLoginCurrentComputer
CheckSlaveInstanceListFromOneComputerPartition
......@@ -644,7 +644,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
StoreSalePackingListLineFromSlaveInstance
StoreSaleOrderFromSlaveInstance
......@@ -678,7 +678,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SlapLoginSoftwareInstanceFromCurrentSoftwareInstance
SetConnectionXmlToSlaveInstance
......@@ -722,7 +722,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
RequestSlaveInstanceFromComputerPartition
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
SlapLoginCurrentSoftwareInstance
......@@ -792,7 +792,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
RequestSlaveInstanceFromComputerPartition
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
SlapLoginCurrentSoftwareInstance
......@@ -822,7 +822,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Logout
Tic
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
......@@ -837,7 +837,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
CallConfirmOrderedSaleOrderAlarm
CallSlaposAllocateInstanceAlarm
Tic
Logout
SlapLoginCurrentSoftwareInstance
......
......@@ -42,7 +42,7 @@ class TestVifibUpgrader(testVifibMixin):
self.assertEqual(1,
self.portal.portal_alarms.accept_submitted_credentials.isEnabled())
self.assertEqual(1,
self.portal.portal_alarms.confirm_ordered_sale_order.isEnabled())
self.portal.portal_alarms.slapos_allocate_instance.isEnabled())
def test_suite():
......
......@@ -58,7 +58,7 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin):
Logout \
\
LoginDefaultUser \
CallConfirmOrderedSaleOrderAlarm \
CallSlaposAllocateInstanceAlarm \
Tic \
SetSelectedComputerPartition \
SelectCurrentlyUsedSalePackingListUid \
......
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