Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos.core
Commits
83e731d9
Commit
83e731d9
authored
Oct 26, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to delivery-less allocation.
parent
bd4bbde2
Changes
39
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
307 additions
and
604 deletions
+307
-604
master/bt5/slapos_cloud/ExtensionTemplateItem/SlapOSCloudSecurity.py
...slapos_cloud/ExtensionTemplateItem/SlapOSCloudSecurity.py
+69
-0
master/bt5/slapos_cloud/PathTemplateItem/portal_alarms/slapos_allocate_instance.xml
...thTemplateItem/portal_alarms/slapos_allocate_instance.xml
+6
-4
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_allocateInstance.xml
...Item/portal_skins/slapos_cloud/Alarm_allocateInstance.xml
+9
-7
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_findPartition.xml
...teItem/portal_skins/slapos_cloud/Person_findPartition.xml
+7
-7
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_isAllowedToAllocate.xml
.../portal_skins/slapos_cloud/Person_isAllowedToAllocate.xml
+1
-9
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_restrictMethodAsShadowUser.xml
..._skins/slapos_cloud/Person_restrictMethodAsShadowUser.xml
+2
-2
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToAllocatePartition.xml
.../slapos_cloud/SoftwareInstance_tryToAllocatePartition.xml
+46
-35
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_allocatePartition.xml
..._workflow/scripts/RequestedInstance_allocatePartition.xml
+1
-1
master/bt5/slapos_cloud/bt/revision
master/bt5/slapos_cloud/bt/revision
+1
-1
master/bt5/slapos_cloud/bt/template_extension_id_list
master/bt5/slapos_cloud/bt/template_extension_id_list
+1
-0
master/bt5/slapos_cloud/bt/template_path_list
master/bt5/slapos_cloud/bt/template_path_list
+1
-0
master/bt5/vifib_base/bt/revision
master/bt5/vifib_base/bt/revision
+1
-1
master/bt5/vifib_erp5/ExtensionTemplateItem/VifibSecurity.py
master/bt5/vifib_erp5/ExtensionTemplateItem/VifibSecurity.py
+0
-31
master/bt5/vifib_erp5/bt/revision
master/bt5/vifib_erp5/bt/revision
+1
-1
master/bt5/vifib_open_trade/bt/revision
master/bt5/vifib_open_trade/bt/revision
+1
-1
master/bt5/vifib_slap/PathTemplateItem/portal_alarms/confirm_ordered_sale_order.xml
...TemplateItem/portal_alarms/confirm_ordered_sale_order.xml
+0
-95
master/bt5/vifib_slap/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
...rtalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
+0
-4
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Alarm_orderPlannedSaleOrder.xml
...m/portal_skins/vifib_slap/Alarm_orderPlannedSaleOrder.xml
+0
-79
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SaleOrderLine_tryToAllocatePartition.xml
...skins/vifib_slap/SaleOrderLine_tryToAllocatePartition.xml
+0
-137
master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/SoftwareInstance_validate.xml
...ction_workflow/interactions/SoftwareInstance_validate.xml
+5
-7
master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/SoftwareInstance_triggerAlarm.xml
...action_workflow/scripts/SoftwareInstance_triggerAlarm.xml
+5
-12
master/bt5/vifib_slap/bt/revision
master/bt5/vifib_slap/bt/revision
+1
-1
master/bt5/vifib_slap/bt/template_path_list
master/bt5/vifib_slap/bt/template_path_list
+0
-2
master/bt5/vifib_slap/bt/template_portal_type_workflow_chain_list
...t5/vifib_slap/bt/template_portal_type_workflow_chain_list
+0
-1
master/bt5/vifib_slapos_rest_api_v1/DocumentTemplateItem/portal_components/VifibRestAPIV1.py
.../DocumentTemplateItem/portal_components/VifibRestAPIV1.py
+1
-5
master/bt5/vifib_slapos_rest_api_v1/bt/revision
master/bt5/vifib_slapos_rest_api_v1/bt/revision
+1
-1
master/product/Vifib/tests/testVifibSlapAllocationScope.py
master/product/Vifib/tests/testVifibSlapAllocationScope.py
+21
-21
master/product/Vifib/tests/testVifibSlapBang.py
master/product/Vifib/tests/testVifibSlapBang.py
+17
-17
master/product/Vifib/tests/testVifibSlapBug.py
master/product/Vifib/tests/testVifibSlapBug.py
+21
-21
master/product/Vifib/tests/testVifibSlapComputerGetComputerPartitionList.py
...ib/tests/testVifibSlapComputerGetComputerPartitionList.py
+2
-2
master/product/Vifib/tests/testVifibSlapComputerPartitionConnection.py
...t/Vifib/tests/testVifibSlapComputerPartitionConnection.py
+1
-1
master/product/Vifib/tests/testVifibSlapComputerPartitionLock.py
...product/Vifib/tests/testVifibSlapComputerPartitionLock.py
+2
-2
master/product/Vifib/tests/testVifibSlapComputerPartitionRequest.py
...duct/Vifib/tests/testVifibSlapComputerPartitionRequest.py
+31
-31
master/product/Vifib/tests/testVifibSlapComputerPartitionUpdate.py
...oduct/Vifib/tests/testVifibSlapComputerPartitionUpdate.py
+1
-1
master/product/Vifib/tests/testVifibSlapOpenOrderRequest.py
master/product/Vifib/tests/testVifibSlapOpenOrderRequest.py
+6
-6
master/product/Vifib/tests/testVifibSlapWebService.py
master/product/Vifib/tests/testVifibSlapWebService.py
+17
-30
master/product/Vifib/tests/testVifibSlapWebServiceSlaveInstance.py
...oduct/Vifib/tests/testVifibSlapWebServiceSlaveInstance.py
+26
-26
master/product/Vifib/tests/testVifibUpgrader.py
master/product/Vifib/tests/testVifibUpgrader.py
+1
-1
master/product/Vifib/tests/testVifibUsageReport.py
master/product/Vifib/tests/testVifibUsageReport.py
+1
-1
No files found.
master/bt5/slapos_cloud/ExtensionTemplateItem/SlapOSCloudSecurity.py
0 → 100644
View file @
83e731d9
###############################################################################
#
# 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
)
master/bt5/
vifib_slap/PathTemplateItem/portal_alarms/order_planned_sale_order
.xml
→
master/bt5/
slapos_cloud/PathTemplateItem/portal_alarms/slapos_allocate_instance
.xml
View file @
83e731d9
...
...
@@ -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 Order
s
</string>
</value>
<value>
<string>
Allocates instance
s
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
master/bt5/
vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Alarm_confirmOrderedSaleOrder
.xml
→
master/bt5/
slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_allocateInstance
.xml
View file @
83e731d9
...
...
@@ -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>
...
...
master/bt5/
vifib_base/SkinTemplateItem/portal_skins/vifib_base/OpenSaleOrder
_findPartition.xml
→
master/bt5/
slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person
_findPartition.xml
View file @
83e731d9
...
...
@@ -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>
...
...
master/bt5/
vifib_open_trade/SkinTemplateItem/portal_skins/vifib_open_trade/Delivery_isDestinationSectionAllowedToRequest
.xml
→
master/bt5/
slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_isAllowedToAllocate
.xml
View file @
83e731d9
...
...
@@ -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>
...
...
master/bt5/
vifib_erp5/SkinTemplateItem/portal_skins/vifib_core/OpenSaleOrder
_restrictMethodAsShadowUser.xml
→
master/bt5/
slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person
_restrictMethodAsShadowUser.xml
View file @
83e731d9
...
...
@@ -12,11 +12,11 @@
</item>
<item>
<key>
<string>
_module
</string>
</key>
<value>
<string>
Vifib
Security
</string>
</value>
<value>
<string>
SlapOSCloud
Security
</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>
...
...
master/bt5/
vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SaleOrderLine_tryToAssociateSoftwareRelease
.xml
→
master/bt5/
slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToAllocatePartition
.xml
View file @
83e731d9
...
...
@@ -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>
S
aleOrderLine_tryToAssociateSoftwareRelease
</string>
</value>
<value>
<string>
S
oftwareInstance_tryToAllocatePartition
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_allocatePartition.xml
View file @
83e731d9
...
...
@@ -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
...
...
master/bt5/slapos_cloud/bt/revision
View file @
83e731d9
102
\ No newline at end of file
103
\ No newline at end of file
master/bt5/slapos_cloud/bt/template_extension_id_list
0 → 100644
View file @
83e731d9
SlapOSCloudSecurity
\ No newline at end of file
master/bt5/slapos_cloud/bt/template_path_list
View file @
83e731d9
...
...
@@ -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
master/bt5/vifib_base/bt/revision
View file @
83e731d9
507
\ No newline at end of file
508
\ No newline at end of file
master/bt5/vifib_erp5/ExtensionTemplateItem/VifibSecurity.py
View file @
83e731d9
...
...
@@ -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."""
...
...
master/bt5/vifib_erp5/bt/revision
View file @
83e731d9
525
\ No newline at end of file
526
\ No newline at end of file
master/bt5/vifib_open_trade/bt/revision
View file @
83e731d9
185
\ No newline at end of file
186
\ No newline at end of file
master/bt5/vifib_slap/PathTemplateItem/portal_alarms/confirm_ordered_sale_order.xml
deleted
100644 → 0
View file @
bd4bbde2
<?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>
master/bt5/vifib_slap/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
View file @
83e731d9
...
...
@@ -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>
...
...
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Alarm_orderPlannedSaleOrder.xml
deleted
100644 → 0
View file @
bd4bbde2
<?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>
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SaleOrderLine_tryToAllocatePartition.xml
deleted
100644 → 0
View file @
bd4bbde2
<?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>
master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/S
aleOrder_reindexObject
.xml
→
master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/S
oftwareInstance_validate
.xml
View file @
83e731d9
...
...
@@ -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>
S
aleOrder_reindexObject
</string>
</value>
<value>
<string>
S
oftwareInstance_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>
...
...
master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/S
aleOrder
_triggerAlarm.xml
→
master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/S
oftwareInstance
_triggerAlarm.xml
View file @
83e731d9
...
...
@@ -50,19 +50,12 @@
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
s
ale_order
= state_change[\'object\']\n
<value>
<string>
s
oftware_instance
= state_change[\'object\']\n
\n
portal = s
ale_order
.getPortalObject()\n
portal = s
oftware_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>
S
aleOrder
_triggerAlarm
</string>
</value>
<value>
<string>
S
oftwareInstance
_triggerAlarm
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
master/bt5/vifib_slap/bt/revision
View file @
83e731d9
855
\ No newline at end of file
856
\ No newline at end of file
master/bt5/vifib_slap/bt/template_path_list
View file @
83e731d9
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
...
...
master/bt5/vifib_slap/bt/template_portal_type_workflow_chain_list
View file @
83e731d9
...
...
@@ -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
...
...
master/bt5/vifib_slapos_rest_api_v1/DocumentTemplateItem/portal_components/VifibRestAPIV1.py
View file @
83e731d9
...
...
@@ -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'
])],
...
...
master/bt5/vifib_slapos_rest_api_v1/bt/revision
View file @
83e731d9
22
\ No newline at end of file
23
\ No newline at end of file
master/product/Vifib/tests/testVifibSlapAllocationScope.py
View file @
83e731d9
...
...
@@ -105,7 +105,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for owner
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -122,7 +122,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# fail to instantiate for someone else
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
CheckNoRelatedSalePackingListLineForSoftwareInstance
Logout
...
...
@@ -135,7 +135,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for owner
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -204,7 +204,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for owner
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -221,7 +221,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for friend
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -238,7 +238,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# fail to instantiate for someone else
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
CheckNoRelatedSalePackingListLineForSoftwareInstance
Logout
...
...
@@ -251,7 +251,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for friend
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -307,7 +307,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for owner
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -324,7 +324,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for someone else
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -379,7 +379,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# fail to instantiate for owner
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
CheckNoRelatedSalePackingListLineForSoftwareInstance
Logout
...
...
@@ -429,7 +429,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# fail to instantiate for owner
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
CheckNoRelatedSalePackingListLineForSoftwareInstance
Logout
...
...
@@ -481,7 +481,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for someone else
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -499,7 +499,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
CheckSoftwareInstanceAndRelatedComputerPartition
CheckRequestedSoftwareInstanceAndRelatedComputerPartition
...
...
@@ -530,7 +530,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for someone else
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -597,7 +597,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for friend
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -617,7 +617,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for someone else
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -653,7 +653,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
CheckSoftwareInstanceAndRelatedComputerPartition
CheckRequestedSoftwareInstanceAndRelatedComputerPartition
...
...
@@ -684,7 +684,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for someone else
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -728,7 +728,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for someone else
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -803,7 +803,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for owner
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Tic
SetSelectedComputerPartition
...
...
@@ -822,7 +822,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# instantiate for someone else
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
master/product/Vifib/tests/testVifibSlapBang.py
View file @
83e731d9
...
...
@@ -26,7 +26,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
root_software_instance
.
requestInstance
(
software_title
=
S1
,
**
common_kw
)
self
.
stepTic
()
self
.
stepCall
ConfirmOrderedSaleOrder
Alarm
()
self
.
stepCall
SlaposAllocateInstance
Alarm
()
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
.
stepCall
ConfirmOrderedSaleOrder
Alarm
()
self
.
stepCall
SlaposAllocateInstance
Alarm
()
self
.
stepTic
()
root_software_instance
.
requestInstance
(
software_title
=
S4
,
**
common_kw
)
self
.
stepTic
()
self
.
stepCall
ConfirmOrderedSaleOrder
Alarm
()
self
.
stepCall
SlaposAllocateInstance
Alarm
()
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
.
stepCall
ConfirmOrderedSaleOrder
Alarm
()
self
.
stepCall
SlaposAllocateInstance
Alarm
()
self
.
stepTic
()
self
.
logout
()
...
...
@@ -397,7 +397,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
</instance>"""
%
sequence
[
'computer_reference_c0'
],
**
common_kw
)
self
.
stepTic
()
self
.
stepCall
ConfirmOrderedSaleOrder
Alarm
()
self
.
stepCall
SlaposAllocateInstance
Alarm
()
self
.
stepTic
()
self
.
logout
()
...
...
@@ -419,7 +419,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
self
.
logout
()
self
.
stepLoginDefaultUser
()
self
.
stepCall
ConfirmOrderedSaleOrder
Alarm
()
self
.
stepCall
SlaposAllocateInstance
Alarm
()
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
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -639,7 +639,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
software_title
=
S1
,
**
common_kw
)
self
.
stepTic
()
self
.
stepCall
ConfirmOrderedSaleOrder
Alarm
()
self
.
stepCall
SlaposAllocateInstance
Alarm
()
self
.
stepTic
()
self
.
logout
()
...
...
@@ -764,7 +764,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
Logout
SlapLoginCurrentSoftwareInstance
Bang
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
SlapLogout
Tic
LoginTestVifibCustomer
...
...
@@ -856,7 +856,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
RenameCurrentSoftwareInstanceDead
Tic
Bang
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
SlapLogout
...
...
@@ -880,7 +880,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SlapLogout
...
...
@@ -892,7 +892,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SlapLogout
...
...
@@ -978,7 +978,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
CheckRaisesNotFoundComputerPartitionParameterDict
Tic
RequestComputerPartition
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SlapLogout
...
...
@@ -988,7 +988,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
RenameCurrentSoftwareInstanceDead
Tic
Bang
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
SlapLogout
...
...
@@ -1002,7 +1002,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SlapLogout
...
...
@@ -1013,7 +1013,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SlapLogout
...
...
@@ -1025,7 +1025,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SlapLogout
...
...
master/product/Vifib/tests/testVifibSlapBug.py
View file @
83e731d9
...
...
@@ -14,7 +14,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
PersonRequestSoftwareInstance
\
Tic
\
Logout
\
Call
ConfirmOrderedSaleOrder
Alarm
\
Call
SlaposAllocateInstance
Alarm
\
CleanTic
\
CallVifibTriggerBuildAlarm
\
CleanTic
\
...
...
@@ -246,7 +246,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
Logout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -350,7 +350,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
...
...
@@ -571,7 +571,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
Logout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -692,7 +692,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
Logout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -710,7 +710,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
SlapLoginCurrentSoftwareInstance
...
...
@@ -740,7 +740,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
SlapLoginCurrentSoftwareInstance
...
...
@@ -859,7 +859,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
Logout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -876,7 +876,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
SlapLoginCurrentSoftwareInstance
...
...
@@ -906,7 +906,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
SlapLoginCurrentSoftwareInstance
...
...
@@ -1033,7 +1033,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
Logout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -1050,7 +1050,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
SlapLoginCurrentSoftwareInstance
...
...
@@ -1121,7 +1121,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
LoginDefaultUser
SetCurrentPersonSlapRequestedSoftwareInstance
SoftwareInstance
SaleOrderLineNoPartitionFound
SoftwareInstance
FailedAllocation
Logout
SlapLoginTestVifibCustomer
...
...
@@ -1130,7 +1130,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
SoftwareInstance
SaleOrderLineNoPartitionFound
SoftwareInstance
FailedAllocation
Logout
LoginERP5TypeTestCase
...
...
@@ -1167,7 +1167,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
...
...
@@ -1237,7 +1237,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
...
...
@@ -1280,7 +1280,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
...
...
@@ -1324,7 +1324,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Logout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -1395,7 +1395,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Logout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -1442,7 +1442,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
SlapLoginCurrentSoftwareInstance
...
...
@@ -1585,7 +1585,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
...
...
master/product/Vifib/tests/testVifibSlapComputerGetComputerPartitionList.py
View file @
83e731d9
...
...
@@ -225,7 +225,7 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin
SlapLogout
\
\
LoginDefaultUser
\
Call
ConfirmOrderedSaleOrder
Alarm
\
Call
SlaposAllocateInstance
Alarm
\
Tic
\
CheckComputerPartitionInstanceSetupSalePackingListDelivered
\
Logout
\
...
...
@@ -255,7 +255,7 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin
SlapLogout
\
\
LoginDefaultUser
\
Call
ConfirmOrderedSaleOrder
Alarm
\
Call
SlaposAllocateInstance
Alarm
\
Tic
\
SetDeliveryLineAmountEqualOne
\
CheckComputerPartitionInstanceSetupSalePackingListDelivered
\
...
...
master/product/Vifib/tests/testVifibSlapComputerPartitionConnection.py
View file @
83e731d9
...
...
@@ -42,7 +42,7 @@ class TestVifibSlapComputerPartitionConnection(TestVifibSlapWebServiceMixin):
Logout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
CheckGetSetConnectionDict
...
...
master/product/Vifib/tests/testVifibSlapComputerPartitionLock.py
View file @
83e731d9
...
...
@@ -65,7 +65,7 @@ class TestVifibSlapComputerPartitionLock(TestVifibSlapWebServiceMixin):
\
LoginDefaultUser
\
SoftwareInstanceSaleOrderConfirmRaisesUnauthorized
\
Call
ConfirmOrderedSaleOrder
Alarm
\
Call
SlaposAllocateInstance
Alarm
\
Tic
\
AssertNoComputerPartition
\
Logout
\
...
...
@@ -94,7 +94,7 @@ class TestVifibSlapComputerPartitionLock(TestVifibSlapWebServiceMixin):
\
LoginDefaultUser
\
SoftwareInstanceSaleOrderConfirmRaisesUnauthorized
\
Call
ConfirmOrderedSaleOrder
Alarm
\
Call
SlaposAllocateInstance
Alarm
\
Tic
\
AssertNoComputerPartition
\
Logout
\
...
...
master/product/Vifib/tests/testVifibSlapComputerPartitionRequest.py
View file @
83e731d9
This diff is collapsed.
Click to expand it.
master/product/Vifib/tests/testVifibSlapComputerPartitionUpdate.py
View file @
83e731d9
...
...
@@ -67,7 +67,7 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin):
Logout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
master/product/Vifib/tests/testVifibSlapOpenOrderRequest.py
View file @
83e731d9
...
...
@@ -41,7 +41,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
...
...
@@ -63,7 +63,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
LoginDefaultUser
SetCurrentPersonSlapRequestedSoftwareInstance
SoftwareInstance
SaleOrderLineNoPartitionFound
SoftwareInstance
FailedAllocation
Logout
LoginERP5TypeTestCase
...
...
@@ -97,7 +97,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
...
...
@@ -155,7 +155,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
...
...
@@ -285,7 +285,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
...
...
@@ -348,7 +348,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
...
...
master/product/Vifib/tests/testVifibSlapWebService.py
View file @
83e731d9
...
...
@@ -355,7 +355,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
portal_type
=
'Sale Order Line'
).
getAggregateValue
(
portal_type
=
'Hosting Subscription'
).
getUid
())
def
stepSoftwareInstance
SaleOrderLineNoPartitionFound
(
self
,
sequence
,
def
stepSoftwareInstance
FailedAllocation
(
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
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
CallVifibTriggerBuildAlarm
CleanTic
...
...
@@ -1128,7 +1121,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
\
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
RequestComputerPartition
\
...
...
@@ -1146,7 +1139,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
RequestComputerPartition
...
...
@@ -1241,7 +1234,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
Logout
\
\
LoginDefaultUser
\
Call
ConfirmOrderedSaleOrder
Alarm
\
Call
SlaposAllocateInstance
Alarm
\
CleanTic
\
CallVifibExpandConfirmedSaleOrderAlarm
\
CleanTic
\
...
...
@@ -1658,7 +1651,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
software_type
,
software_type
+
str
(
2
))
self
.
stepLoginDefaultUser
()
self
.
stepTic
()
self
.
stepCall
ConfirmOrderedSaleOrder
Alarm
()
self
.
stepCall
SlaposAllocateInstance
Alarm
()
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
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
master/product/Vifib/tests/testVifibSlapWebServiceSlaveInstance.py
View file @
83e731d9
...
...
@@ -59,7 +59,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
Logout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Tic # in order to call real build
CheckComputerPartitionSaleOrderAggregatedList
...
...
@@ -92,7 +92,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
Logout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
CheckSlaveInstanceNotReady
Logout
...
...
@@ -118,7 +118,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Logout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
...
...
@@ -149,7 +149,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SlapLogout
LoginTestVifibCustomer
...
...
@@ -183,7 +183,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
SetSoftwareTitleRandom
PersonRequestSlaveInstance
Tic
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SlapLoginCurrentComputer
SoftwareInstanceAvailable
...
...
@@ -216,13 +216,13 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
SetSoftwareTitleRandom
PersonRequestSoftwareInstance
CleanTic
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
LoginTestVifibCustomer
SetSoftwareTitleRandom
PersonRequestSlaveInstance
Tic
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SlapLoginCurrentComputer
SoftwareInstanceAvailable
...
...
@@ -250,7 +250,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
SetSoftwareTitleRandom
PersonRequestSlaveInstance
Tic
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
CheckSlaveInstanceNotReady
Logout
...
...
@@ -280,7 +280,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
SetSoftwareTitleRandom
PersonRequestSlaveInstance
Tic
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
CheckSlaveInstanceReady
CheckSlaveInstanceAllocationWithTwoDifferentSoftwareInstance
...
...
@@ -307,7 +307,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
SetSoftwareTitleRandom
PersonRequestSlaveInstance
Tic
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
"""
+
self
.
prepare_published_software_release
+
"""
Tic
...
...
@@ -323,14 +323,14 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
SetSoftwareTitleRandom
PersonRequestSoftwareInstance
CleanTic
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SelectDifferentSoftwareReleaseUri
LoginTestVifibCustomer
SetSoftwareTitleRandom
PersonRequestSlaveInstance
Tic
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
CheckSlaveInstanceAssociationWithSoftwareInstance
SlapLogout
...
...
@@ -362,7 +362,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
CheckTwoSlaveInstanceRequest
SlapLogout
...
...
@@ -395,7 +395,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SlapLogout
SlapLoginCurrentComputer
...
...
@@ -441,7 +441,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SlapLogout
SlapLoginCurrentComputer
...
...
@@ -493,7 +493,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
SlapLoginCurrentComputer
...
...
@@ -545,7 +545,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
LoginTestVifibCustomer
RequestSoftwareInstanceDestroy
...
...
@@ -575,7 +575,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SlapLogout
LoginAsCustomerA
...
...
@@ -584,7 +584,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SlapLogout
LoginTestVifibCustomer
...
...
@@ -615,7 +615,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SlapLoginCurrentComputer
CheckSlaveInstanceListFromOneComputerPartition
...
...
@@ -644,7 +644,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
StoreSalePackingListLineFromSlaveInstance
StoreSaleOrderFromSlaveInstance
...
...
@@ -678,7 +678,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SlapLoginSoftwareInstanceFromCurrentSoftwareInstance
SetConnectionXmlToSlaveInstance
...
...
@@ -722,7 +722,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
RequestSlaveInstanceFromComputerPartition
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
SlapLoginCurrentSoftwareInstance
...
...
@@ -792,7 +792,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
RequestSlaveInstanceFromComputerPartition
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
SlapLoginCurrentSoftwareInstance
...
...
@@ -822,7 +822,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Logout
Tic
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
...
...
@@ -837,7 +837,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginDefaultUser
Call
ConfirmOrderedSaleOrder
Alarm
Call
SlaposAllocateInstance
Alarm
Tic
Logout
SlapLoginCurrentSoftwareInstance
...
...
master/product/Vifib/tests/testVifibUpgrader.py
View file @
83e731d9
...
...
@@ -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
():
...
...
master/product/Vifib/tests/testVifibUsageReport.py
View file @
83e731d9
...
...
@@ -58,7 +58,7 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin):
Logout
\
\
LoginDefaultUser
\
Call
ConfirmOrderedSaleOrder
Alarm
\
Call
SlaposAllocateInstance
Alarm
\
Tic
\
SetSelectedComputerPartition
\
SelectCurrentlyUsedSalePackingListUid
\
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment