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
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Rafael Monnerat
slapos.core
Commits
15af6f15
Commit
15af6f15
authored
Jan 14, 2022
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_pdm: Implement upgrade_slap_interface_workflow
parent
8b2bc6fd
Pipeline
#19424
failed with stage
in 0 seconds
Changes
39
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
1653 additions
and
398 deletions
+1653
-398
master/bt5/slapos_pdm/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
...rtalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
+1
-1
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_processStartedUpgradeDecision.py
...l_skins/slapos_pdm/Alarm_processStartedUpgradeDecision.py
+1
-1
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/ComputeNode_checkAndCreateUpgradeDecision.py
...s/slapos_pdm/ComputeNode_checkAndCreateUpgradeDecision.py
+7
-11
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/InstanceTree_createUpgradeDecision.py
...al_skins/slapos_pdm/InstanceTree_createUpgradeDecision.py
+8
-13
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getAggregateValue.py
...tal_skins/slapos_pdm/UpgradeDecision_getAggregateValue.py
+5
-2
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getSoftwareRelease.py
...al_skins/slapos_pdm/UpgradeDecision_getSoftwareRelease.py
+0
-13
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_isUpgradeFinished.py
...tal_skins/slapos_pdm/UpgradeDecision_isUpgradeFinished.py
+1
-1
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notify.py
...ateItem/portal_skins/slapos_pdm/UpgradeDecision_notify.py
+1
-1
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notifyDelivered.py
...ortal_skins/slapos_pdm/UpgradeDecision_notifyDelivered.py
+1
-1
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_processUpgrade.py
...portal_skins/slapos_pdm/UpgradeDecision_processUpgrade.py
+0
-7
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_tryToCancel.xml
...m/portal_skins/slapos_pdm/UpgradeDecision_tryToCancel.xml
+0
-62
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_upgradeComputeNode.py
...al_skins/slapos_pdm/UpgradeDecision_upgradeComputeNode.py
+0
-21
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudUpgradeSlapInterfaceWorkflow.py
.../test.erp5.testSlapOSCloudUpgradeSlapInterfaceWorkflow.py
+555
-0
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudUpgradeSlapInterfaceWorkflow.xml
...test.erp5.testSlapOSCloudUpgradeSlapInterfaceWorkflow.xml
+133
-0
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
...ents/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
+5
-4
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSPDMSkins.py
+0
-245
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow.xml
...eItem/portal_workflow/upgrade_slap_interface_workflow.xml
+108
-0
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_approveRegistration.py
...ce_workflow/script_UpgradeDecision_approveRegistration.py
+38
-0
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_approveRegistration.xml
...e_workflow/script_UpgradeDecision_approveRegistration.xml
+25
-3
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_checkConsistency.py
...rface_workflow/script_UpgradeDecision_checkConsistency.py
+2
-0
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_checkConsistency.xml
...face_workflow/script_UpgradeDecision_checkConsistency.xml
+19
-3
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_requestUpgrade.py
...terface_workflow/script_UpgradeDecision_requestUpgrade.py
+56
-0
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_requestUpgrade.xml
...erface_workflow/script_UpgradeDecision_requestUpgrade.xml
+25
-3
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_reviewRegistration.py
...ace_workflow/script_UpgradeDecision_reviewRegistration.py
+38
-0
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_reviewRegistration.xml
...ce_workflow/script_UpgradeDecision_reviewRegistration.xml
+25
-3
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/state_draft.xml
..._workflow/upgrade_slap_interface_workflow/state_draft.xml
+79
-0
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/transition_approve_registration.xml
...ap_interface_workflow/transition_approve_registration.xml
+68
-0
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/transition_requestUpgrade.xml
...ade_slap_interface_workflow/transition_requestUpgrade.xml
+66
-0
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/transition_review_registration.xml
...lap_interface_workflow/transition_review_registration.xml
+66
-0
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/variable_action.xml
...kflow/upgrade_slap_interface_workflow/variable_action.xml
+46
-0
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/variable_actor.xml
...rkflow/upgrade_slap_interface_workflow/variable_actor.xml
+46
-0
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/variable_comment.xml
...flow/upgrade_slap_interface_workflow/variable_comment.xml
+46
-0
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/variable_error_message.xml
...pgrade_slap_interface_workflow/variable_error_message.xml
+42
-0
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/variable_history.xml
...flow/upgrade_slap_interface_workflow/variable_history.xml
+46
-0
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/variable_portal_type.xml
.../upgrade_slap_interface_workflow/variable_portal_type.xml
+42
-0
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/variable_time.xml
...orkflow/upgrade_slap_interface_workflow/variable_time.xml
+46
-0
master/bt5/slapos_pdm/bt/template_portal_type_workflow_chain_list
...t5/slapos_pdm/bt/template_portal_type_workflow_chain_list
+2
-1
master/bt5/slapos_pdm/bt/template_test_id_list
master/bt5/slapos_pdm/bt/template_test_id_list
+2
-1
master/bt5/slapos_pdm/bt/template_workflow_id_list
master/bt5/slapos_pdm/bt/template_workflow_id_list
+2
-1
No files found.
master/bt5/slapos_pdm/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
View file @
15af6f15
...
...
@@ -5,6 +5,6 @@
</chain>
<chain>
<type>
Upgrade Decision
</type>
<workflow>
edit_workflow, ticket_interaction_workflow, upgrade_decision_workflow
</workflow>
<workflow>
edit_workflow, ticket_interaction_workflow, upgrade_decision_workflow
, upgrade_slap_interface_workflow
</workflow>
</chain>
</workflow_chain>
\ No newline at end of file
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_processStartedUpgradeDecision.py
View file @
15af6f15
...
...
@@ -2,7 +2,7 @@ portal = context.getPortalObject()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Upgrade Decision'
,
simulation_state
=
'started'
,
method_id
=
'
UpgradeDecision_process
Upgrade'
,
method_id
=
'
request
Upgrade'
,
activate_kw
=
{
'tag'
:
tag
}
)
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/ComputeNode_checkAndCreateUpgradeDecision.py
View file @
15af6f15
...
...
@@ -41,22 +41,18 @@ for software_release in software_release_list:
# If exist upgrade decision in progress try to cancel it
decision_in_progress
=
newer_release
.
\
SoftwareRelease_getUpgradeDecisionInProgress
(
compute_node
.
getUid
())
if
decision_in_progress
and
\
not
decision_in_progress
.
UpgradeDecision_tryToCancel
(
newer_release
.
getUrlString
()):
if
decision_in_progress
:
decision_in_progress
.
reviewRegistration
(
software_release_url
=
newer_release
.
getUrlString
())
if
decision_in_progress
.
getSimulationState
()
!=
"cancelled"
:
continue
upgrade_decision
=
newer_release
.
SoftwareRelease_createUpgradeDecision
(
source_url
=
compute_node
.
getRelativeUrl
(),
title
=
title
)
if
context
.
getUpgradeScope
()
==
"auto"
:
upgrade_decision
.
start
()
elif
context
.
getUpgradeScope
(
"ask_confirmation"
)
==
"ask_confirmation"
\
and
upgrade_decision
.
getSimulationState
()
!=
"planned"
:
upgrade_decision
.
plan
()
upgrade_decision
.
setStartDate
(
DateTime
())
upgrade_decision
.
approveRegistration
(
upgrade_scope
=
compute_node
.
getUpgradeScope
(
"ask_confirmation"
))
upgrade_decision_list
.
append
(
upgrade_decision
)
return
upgrade_decision_list
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/InstanceTree_createUpgradeDecision.py
View file @
15af6f15
...
...
@@ -2,7 +2,7 @@ from DateTime import DateTime
portal
=
context
.
getPortalObject
()
instance_tree
=
context
upgrade_scope
=
context
.
getUpgradeScope
()
upgrade_scope
=
context
.
getUpgradeScope
(
"ask_confirmation"
)
if
upgrade_scope
in
[
"never"
,
"disabled"
]:
return
...
...
@@ -22,7 +22,6 @@ if instance_tree.getSlapState() == "destroy_requested":
return
tag
=
"%s_requestUpgradeDecisionCreation_inProgress"
%
instance_tree
.
getUid
()
activate_kw
=
{
'tag'
:
tag
}
if
portal
.
portal_activities
.
countMessageWithTag
(
tag
)
>
0
:
# nothing to do
return
...
...
@@ -52,22 +51,18 @@ if newer_release is None:
decision_in_progress
=
newer_release
.
\
SoftwareRelease_getUpgradeDecisionInProgress
(
instance_tree
.
getUid
())
if
decision_in_progress
and
\
not
decision_in_progress
.
UpgradeDecision_tryToCancel
(
newer_release
.
getUrlString
()):
if
decision_in_progress
:
decision_in_progress
.
reviewRegistration
(
software_release_url
=
newer_release
.
getUrlString
())
if
decision_in_progress
.
getSimulationState
()
!=
"cancelled"
:
return
upgrade_decision
=
newer_release
.
SoftwareRelease_createUpgradeDecision
(
source_url
=
instance_tree
.
getRelativeUrl
(),
title
=
decision_title
)
with
upgrade_decision
.
defaultActivateParameterDict
(
activate_kw
):
upgrade_decision
.
plan
()
upgrade_decision
.
setStartDate
(
DateTime
())
if
upgrade_scope
==
"auto"
:
upgrade_decision
.
start
()
# Prevent concurrent transaction to create 2 upgrade decision for the same instance_tree
instance_tree
.
serialize
(
)
upgrade_decision
.
approveRegistration
(
upgrade_scope
=
upgrade_scope
)
return
upgrade_decision
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getAggregateValue.py
View file @
15af6f15
document_list
=
[]
for
decision_line
in
context
.
contentValues
():
try
:
document_list
.
extend
(
decision_line
.
getAggregateValueList
(
portal_type
=
document_portal_type
))
except
:
raise
ValueError
(
context
)
if
len
(
document_list
)
>
1
:
raise
ValueError
(
"It is only allowed to have more them 1 %s"
%
document_list
)
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getSoftwareRelease.py
deleted
100644 → 0
View file @
8b2bc6fd
software_release_list
=
[]
for
decision_line
in
context
.
contentValues
():
software_release_list
.
extend
(
decision_line
.
getAggregateValueList
(
portal_type
=
"Software Release"
))
if
len
(
software_release_list
)
>
1
:
raise
ValueError
(
"It is only allowed to have more them 1 Software Release"
)
if
len
(
software_release_list
)
==
0
:
return
None
return
software_release_list
[
0
]
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_isUpgradeFinished.py
View file @
15af6f15
...
...
@@ -2,7 +2,7 @@ portal = context.getPortalObject()
instance_tree
=
context
.
UpgradeDecision_getAggregateValue
(
"Instance Tree"
)
compute_node
=
context
.
UpgradeDecision_getAggregateValue
(
"Compute Node"
)
software_release
=
context
.
UpgradeDecision_get
SoftwareRelease
(
)
software_release
=
context
.
UpgradeDecision_get
AggregateValue
(
"Software Release"
)
if
instance_tree
is
not
None
:
if
instance_tree
.
getUrlString
()
==
software_release
.
getUrlString
():
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notify.py
View file @
15af6f15
from
DateTime
import
DateTime
return
if
context
.
getSimulationState
()
!=
'planned'
:
# XXX Don't notify the ones which are not planned.
return
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notifyDelivered.py
View file @
15af6f15
...
...
@@ -15,7 +15,7 @@ if not person:
instance_tree
=
context
.
UpgradeDecision_getAggregateValue
(
"Instance Tree"
)
compute_node
=
context
.
UpgradeDecision_getAggregateValue
(
"Compute Node"
)
software_release
=
context
.
UpgradeDecision_get
SoftwareRelease
(
)
software_release
=
context
.
UpgradeDecision_get
AggregateValue
(
"Software Release"
)
software_product_title
=
software_release
.
getAggregateTitle
(
portal_type
=
"Software Product"
)
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_processUpgrade.py
deleted
100644 → 0
View file @
8b2bc6fd
if
context
.
UpgradeDecision_upgradeInstanceTree
():
return
True
if
context
.
UpgradeDecision_upgradeComputeNode
():
return
True
return
False
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_tryToCancel.xml
deleted
100644 → 0
View file @
8b2bc6fd
<?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>
_params
</string>
</key>
<value>
<string>
new_url_string
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
UpgradeDecision_tryToCancel
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_upgradeComputeNode.py
deleted
100644 → 0
View file @
8b2bc6fd
if
context
.
getSimulationState
()
!=
'started'
:
# Update Decision is not on started state, Upgrade is not possible!
return
False
compute_node
=
context
.
UpgradeDecision_getAggregateValue
(
"Compute Node"
)
software_release
=
context
.
UpgradeDecision_getSoftwareRelease
()
if
compute_node
is
None
:
return
False
if
software_release
is
None
:
return
False
software_release_url
=
software_release
.
getUrlString
()
compute_node
.
requestSoftwareRelease
(
software_release_url
=
software_release_url
,
state
=
"available"
)
context
.
stop
()
return
True
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudUpgradeSlapInterfaceWorkflow.py
0 → 100644
View file @
15af6f15
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
,
simulate
#from zExceptions import Unauthorized
import
transaction
class
TestSlapOSCoreProjectSlapInterfaceWorkflow
(
SlapOSTestCaseMixin
):
def
afterSetUp
(
self
):
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
portal
=
self
.
getPortalObject
()
person_user
=
self
.
makePerson
()
self
.
tic
()
self
.
login
()
self
.
compute_node
=
self
.
portal
.
compute_node_module
.
template_compute_node
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
new_id
=
self
.
generateNewId
()
self
.
compute_node
.
edit
(
title
=
"compute node %s"
%
(
new_id
,
),
reference
=
"TESTCOMP-%s"
%
(
new_id
,
),
source_administration
=
person_user
.
getRelativeUrl
()
)
self
.
compute_node
.
validate
()
self
.
upgrade_decision
=
portal
.
upgrade_decision_module
.
newContent
(
portal_type
=
"Upgrade Decision"
,
)
# Value set by the init
self
.
assertTrue
(
self
.
upgrade_decision
.
getReference
().
startswith
(
"UD-"
),
"Reference don't start with UD- : %s"
%
self
.
upgrade_decision
.
getReference
())
self
.
software_release
=
self
.
_makeSoftwareRelease
()
self
.
tic
()
def
_addUpgradeLine
(
self
,
aggregate
):
self
.
upgrade_decision
.
newContent
(
portal_type
=
"Upgrade Decision Line"
,
aggregate_value_list
=
[
self
.
software_release
,
aggregate
]
)
def
beforeTearDown
(
self
):
transaction
.
abort
()
def
test_upgrade_decision_approveRegistration_no_line
(
self
):
self
.
assertRaises
(
ValueError
,
self
.
upgrade_decision
.
approveRegistration
)
def
test_upgrade_decision_approveRegistration_no_aggregate
(
self
):
self
.
upgrade_decision
.
newContent
(
portal_type
=
"Upgrade Decision Line"
,
aggregate
=
self
.
software_release
.
getRelativeUrl
()
)
self
.
assertRaises
(
ValueError
,
self
.
upgrade_decision
.
approveRegistration
)
def
test_upgrade_decision_approveRegistration_no_upgrade_scope
(
self
):
self
.
_addUpgradeLine
(
self
.
compute_node
)
self
.
assertRaises
(
TypeError
,
self
.
upgrade_decision
.
approveRegistration
)
def
test_upgrade_decision_approveRegistration_computer
(
self
):
self
.
_addUpgradeLine
(
self
.
compute_node
)
self
.
upgrade_decision
.
approveRegistration
(
upgrade_scope
=
"ask_confirmation"
)
self
.
assertEqual
(
"planned"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
commit
()
tag
=
"%s_requestUpgradeDecisionCreation_inProgress"
%
self
.
compute_node
.
getUid
()
self
.
assertEqual
(
2
,
self
.
portal
.
portal_activities
.
countMessageWithTag
(
tag
))
# Call again does nothing
self
.
upgrade_decision
.
approveRegistration
(
upgrade_scope
=
"ask_confirmation"
)
self
.
assertEqual
(
"planned"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
commit
()
tag
=
"%s_requestUpgradeDecisionCreation_inProgress"
%
self
.
compute_node
.
getUid
()
self
.
assertEqual
(
2
,
self
.
portal
.
portal_activities
.
countMessageWithTag
(
tag
))
self
.
tic
()
# Call again does nothing again
self
.
upgrade_decision
.
approveRegistration
(
upgrade_scope
=
"ask_confirmation"
)
self
.
assertEqual
(
"planned"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
commit
()
tag
=
"%s_requestUpgradeDecisionCreation_inProgress"
%
self
.
compute_node
.
getUid
()
self
.
assertEqual
(
2
,
self
.
portal
.
portal_activities
.
countMessageWithTag
(
tag
))
def
test_upgrade_decision_approveRegistration_instance_tree
(
self
):
self
.
_makeTree
()
self
.
_addUpgradeLine
(
self
.
instance_tree
)
self
.
upgrade_decision
.
approveRegistration
(
upgrade_scope
=
"ask_confirmation"
)
self
.
assertEqual
(
"planned"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
commit
()
tag
=
"%s_requestUpgradeDecisionCreation_inProgress"
%
self
.
instance_tree
.
getUid
()
self
.
assertEqual
(
2
,
self
.
portal
.
portal_activities
.
countMessageWithTag
(
tag
))
# Call again does nothing
self
.
upgrade_decision
.
approveRegistration
(
upgrade_scope
=
"ask_confirmation"
)
self
.
assertEqual
(
"planned"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
commit
()
tag
=
"%s_requestUpgradeDecisionCreation_inProgress"
%
self
.
instance_tree
.
getUid
()
self
.
assertEqual
(
2
,
self
.
portal
.
portal_activities
.
countMessageWithTag
(
tag
))
self
.
tic
()
# Call again does nothing again
self
.
upgrade_decision
.
approveRegistration
(
upgrade_scope
=
"ask_confirmation"
)
self
.
assertEqual
(
"planned"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
commit
()
tag
=
"%s_requestUpgradeDecisionCreation_inProgress"
%
self
.
instance_tree
.
getUid
()
self
.
assertEqual
(
2
,
self
.
portal
.
portal_activities
.
countMessageWithTag
(
tag
))
def
test_upgrade_decision_approveRegistration_computer_auto
(
self
):
self
.
_addUpgradeLine
(
self
.
compute_node
)
self
.
upgrade_decision
.
approveRegistration
(
upgrade_scope
=
"auto"
)
self
.
assertEqual
(
"started"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
commit
()
tag
=
"%s_requestUpgradeDecisionCreation_inProgress"
%
self
.
compute_node
.
getUid
()
self
.
assertEqual
(
2
,
self
.
portal
.
portal_activities
.
countMessageWithTag
(
tag
))
# Call again does nothing
self
.
upgrade_decision
.
approveRegistration
(
upgrade_scope
=
"auto"
)
self
.
assertEqual
(
"started"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
commit
()
tag
=
"%s_requestUpgradeDecisionCreation_inProgress"
%
self
.
compute_node
.
getUid
()
self
.
assertEqual
(
2
,
self
.
portal
.
portal_activities
.
countMessageWithTag
(
tag
))
self
.
tic
()
# Call again does nothing again
self
.
upgrade_decision
.
approveRegistration
(
upgrade_scope
=
"auto"
)
self
.
assertEqual
(
"started"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
commit
()
tag
=
"%s_requestUpgradeDecisionCreation_inProgress"
%
self
.
compute_node
.
getUid
()
self
.
assertEqual
(
2
,
self
.
portal
.
portal_activities
.
countMessageWithTag
(
tag
))
def
test_upgrade_decision_approveRegistration_instance_tree_auto
(
self
):
self
.
_makeTree
()
self
.
_addUpgradeLine
(
self
.
instance_tree
)
self
.
upgrade_decision
.
approveRegistration
(
upgrade_scope
=
"auto"
)
self
.
assertEqual
(
"started"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
commit
()
tag
=
"%s_requestUpgradeDecisionCreation_inProgress"
%
self
.
instance_tree
.
getUid
()
self
.
assertEqual
(
2
,
self
.
portal
.
portal_activities
.
countMessageWithTag
(
tag
))
# Call again does nothing
self
.
upgrade_decision
.
approveRegistration
(
upgrade_scope
=
"auto"
)
self
.
assertEqual
(
"started"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
commit
()
tag
=
"%s_requestUpgradeDecisionCreation_inProgress"
%
self
.
instance_tree
.
getUid
()
self
.
assertEqual
(
2
,
self
.
portal
.
portal_activities
.
countMessageWithTag
(
tag
))
self
.
tic
()
# Call again does nothing again
# Call again does nothing
self
.
upgrade_decision
.
approveRegistration
(
upgrade_scope
=
"auto"
)
self
.
assertEqual
(
"started"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
commit
()
tag
=
"%s_requestUpgradeDecisionCreation_inProgress"
%
self
.
instance_tree
.
getUid
()
self
.
assertEqual
(
2
,
self
.
portal
.
portal_activities
.
countMessageWithTag
(
tag
))
def
test_upgrade_decision_reviewRegistration_no_software_release_url
(
self
):
self
.
assertRaises
(
TypeError
,
self
.
upgrade_decision
.
reviewRegistration
)
def
test_upgrade_decision_reviewRegistration_draft
(
self
):
# Do nothing as draft
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
software_release
)
def
test_upgrade_decision_reviewRegistration
(
self
):
self
.
_addUpgradeLine
(
self
.
compute_node
)
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
software_release
)
self
.
assertEqual
(
"draft"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
upgrade_decision
.
plan
()
self
.
tic
()
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
software_release
)
self
.
assertEqual
(
"cancelled"
,
self
.
upgrade_decision
.
getSimulationState
())
def
test_upgrade_decision_reviewRegistration_confirm
(
self
):
self
.
_addUpgradeLine
(
self
.
compute_node
)
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
software_release
)
self
.
assertEqual
(
"draft"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
upgrade_decision
.
confirm
()
self
.
tic
()
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
software_release
)
self
.
assertEqual
(
"cancelled"
,
self
.
upgrade_decision
.
getSimulationState
())
def
test_upgrade_decision_reviewRegistration_rejected
(
self
):
self
.
_addUpgradeLine
(
self
.
compute_node
)
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
software_release
)
self
.
assertEqual
(
"draft"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
upgrade_decision
.
reject
()
self
.
tic
()
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
software_release
)
self
.
assertEqual
(
"rejected"
,
self
.
upgrade_decision
.
getSimulationState
())
def
test_upgrade_decision_reviewRegistration_same_url
(
self
):
self
.
_addUpgradeLine
(
self
.
compute_node
)
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
self
.
software_release
.
getUrlString
())
self
.
assertEqual
(
"draft"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
upgrade_decision
.
plan
()
self
.
tic
()
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
self
.
software_release
.
getUrlString
())
self
.
assertEqual
(
"planned"
,
self
.
upgrade_decision
.
getSimulationState
())
def
test_upgrade_decision_reviewRegistration_confirm_same_url
(
self
):
self
.
_addUpgradeLine
(
self
.
compute_node
)
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
self
.
software_release
.
getUrlString
())
self
.
assertEqual
(
"draft"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
upgrade_decision
.
confirm
()
self
.
tic
()
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
self
.
software_release
.
getUrlString
())
self
.
assertEqual
(
"confirmed"
,
self
.
upgrade_decision
.
getSimulationState
())
def
test_upgrade_decision_reviewRegistration_rejected_same_url
(
self
):
self
.
_addUpgradeLine
(
self
.
compute_node
)
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
self
.
software_release
.
getUrlString
())
self
.
assertEqual
(
"draft"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
upgrade_decision
.
reject
()
self
.
tic
()
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
self
.
software_release
.
getUrlString
())
self
.
assertEqual
(
"rejected"
,
self
.
upgrade_decision
.
getSimulationState
())
def
test_upgrade_decision_reviewRegistration_started
(
self
):
self
.
_addUpgradeLine
(
self
.
compute_node
)
software_release
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
software_release
)
self
.
assertEqual
(
"draft"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
upgrade_decision
.
plan
()
self
.
upgrade_decision
.
start
()
self
.
tic
()
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
software_release
)
self
.
assertEqual
(
"started"
,
self
.
upgrade_decision
.
getSimulationState
())
def
test_upgrade_decision_reviewRegistration_instance_tree
(
self
):
self
.
_makeTree
()
self
.
_addUpgradeLine
(
self
.
instance_tree
)
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
self
.
instance_tree
.
getUrlString
())
self
.
assertEqual
(
"draft"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
upgrade_decision
.
plan
()
self
.
tic
()
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
self
.
instance_tree
.
getUrlString
())
self
.
assertEqual
(
"cancelled"
,
self
.
upgrade_decision
.
getSimulationState
())
def
test_upgrade_decision_reviewRegistration_instance_tree_confirmed
(
self
):
self
.
_makeTree
()
self
.
_addUpgradeLine
(
self
.
instance_tree
)
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
self
.
instance_tree
.
getUrlString
())
self
.
assertEqual
(
"draft"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
upgrade_decision
.
confirm
()
self
.
tic
()
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
self
.
instance_tree
.
getUrlString
())
self
.
assertEqual
(
"cancelled"
,
self
.
upgrade_decision
.
getSimulationState
())
def
test_upgrade_decision_reviewRegistration_instance_tree_started
(
self
):
self
.
_makeTree
()
self
.
_addUpgradeLine
(
self
.
instance_tree
)
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
self
.
instance_tree
.
getUrlString
())
self
.
assertEqual
(
"draft"
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
upgrade_decision
.
start
()
self
.
tic
()
self
.
upgrade_decision
.
reviewRegistration
(
software_release_url
=
self
.
instance_tree
.
getUrlString
())
self
.
assertEqual
(
"started"
,
self
.
upgrade_decision
.
getSimulationState
())
@
simulate
(
'InstanceTree_isUpgradePossible'
,
'software_release_url'
,
'return 1'
)
def
test_upgrade_decision_requestUpgrade_instance_tree
(
self
):
self
.
_makeTree
()
self
.
_addUpgradeLine
(
self
.
instance_tree
)
self
.
tic
()
slap_state
=
self
.
instance_tree
.
getSlapState
()
self
.
upgrade_decision
.
requestUpgrade
()
self
.
assertNotEqual
(
self
.
software_release
.
getUrlString
(),
self
.
instance_tree
.
getUrlString
())
self
.
upgrade_decision
.
confirm
()
self
.
upgrade_decision
.
start
()
# Check that url_string change, but slap state doesn't
self
.
assertNotEqual
(
self
.
software_release
.
getUrlString
(),
self
.
instance_tree
.
getUrlString
())
self
.
upgrade_decision
.
requestUpgrade
()
self
.
assertEqual
(
self
.
software_release
.
getUrlString
(),
self
.
instance_tree
.
getUrlString
())
self
.
assertEqual
(
slap_state
,
self
.
instance_tree
.
getSlapState
())
self
.
assertEqual
(
'stopped'
,
self
.
upgrade_decision
.
getSimulationState
())
def
test_upgrade_decision_requestUpgrade_instance_tree_no_software_release
(
self
):
self
.
_makeTree
()
self
.
upgrade_decision
.
newContent
(
portal_type
=
"Upgrade Decision Line"
,
aggregate_value_list
=
[
self
.
instance_tree
]
)
self
.
upgrade_decision
.
confirm
()
self
.
upgrade_decision
.
start
()
self
.
tic
()
self
.
upgrade_decision
.
requestUpgrade
()
self
.
assertEqual
(
'started'
,
self
.
upgrade_decision
.
getSimulationState
())
def
test_upgrade_decision_requestUpgrade_compute_node_no_software_release
(
self
):
self
.
upgrade_decision
.
newContent
(
portal_type
=
"Upgrade Decision Line"
,
aggregate_value_list
=
[
self
.
compute_node
]
)
self
.
upgrade_decision
.
confirm
()
self
.
upgrade_decision
.
start
()
self
.
tic
()
self
.
upgrade_decision
.
requestUpgrade
()
self
.
assertEqual
(
'started'
,
self
.
upgrade_decision
.
getSimulationState
())
def
test_upgrade_decision_requestUpgrade_only_software_release
(
self
):
self
.
upgrade_decision
.
newContent
(
portal_type
=
"Upgrade Decision Line"
,
aggregate_value_list
=
[
self
.
software_release
]
)
self
.
upgrade_decision
.
confirm
()
self
.
upgrade_decision
.
start
()
self
.
tic
()
self
.
upgrade_decision
.
requestUpgrade
()
self
.
assertEqual
(
'started'
,
self
.
upgrade_decision
.
getSimulationState
())
def
test_upgrade_decision_requestUpgrade_duplicated
(
self
):
self
.
_makeTree
()
self
.
upgrade_decision
.
newContent
(
portal_type
=
"Upgrade Decision Line"
,
aggregate_value_list
=
[
self
.
software_release
,
self
.
instance_tree
,
self
.
compute_node
]
)
self
.
upgrade_decision
.
confirm
()
self
.
upgrade_decision
.
start
()
self
.
tic
()
self
.
assertRaises
(
ValueError
,
self
.
upgrade_decision
.
requestUpgrade
)
self
.
assertEqual
(
'started'
,
self
.
upgrade_decision
.
getSimulationState
())
def
test_upgrade_decision_requestUpgrade_compute_node
(
self
):
self
.
_addUpgradeLine
(
self
.
compute_node
)
self
.
upgrade_decision
.
confirm
()
self
.
upgrade_decision
.
start
()
self
.
tic
()
self
.
upgrade_decision
.
requestUpgrade
()
self
.
tic
()
self
.
assertEqual
(
'stopped'
,
self
.
upgrade_decision
.
getSimulationState
())
software_installation
=
self
.
compute_node
.
getAggregateRelatedValue
(
portal_type
=
'Software Installation'
)
self
.
assertEqual
(
'start_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
self
.
software_release
.
getUrlString
(),
software_installation
.
getUrlString
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
def
test_upgrade_decision_requestUpgrade_hosting_subscription
(
self
):
self
.
_makeTree
()
self
.
_addUpgradeLine
(
self
.
instance_tree
)
self
.
assertNotEqual
(
self
.
instance_tree
.
getUrlString
(),
self
.
software_release
.
getUrlString
())
slap_state
=
self
.
instance_tree
.
getSlapState
()
self
.
upgrade_decision
.
confirm
()
self
.
upgrade_decision
.
start
()
self
.
tic
()
self
.
upgrade_decision
.
requestUpgrade
()
self
.
tic
()
self
.
assertEqual
(
'stopped'
,
self
.
upgrade_decision
.
getSimulationState
())
self
.
assertEqual
(
self
.
instance_tree
.
getUrlString
(),
self
.
software_release
.
getUrlString
())
self
.
assertEqual
(
slap_state
,
self
.
instance_tree
.
getSlapState
())
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudUpgradeSlapInterfaceWorkflow.xml
0 → 100644
View file @
15af6f15
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Test Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSCloudUpgradeSlapInterfaceWorkflow
</string>
</value>
</item>
<item>
<key>
<string>
default_source_reference
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testSlapOSCloudUpgradeSlapInterfaceWorkflow
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Test Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
View file @
15af6f15
...
...
@@ -287,8 +287,9 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
self
.
assertEqual
(
up_decision
.
UpgradeDecision_getAggregateValue
(
"Instance Tree"
).
\
getReference
(),
instance_tree
.
getReference
())
self
.
assertEqual
(
up_decision
.
UpgradeDecision_getSoftwareRelease
().
\
getUrlString
(),
software_release2
.
getUrlString
())
self
.
assertEqual
(
software_release2
.
getUrlString
(),
up_decision
.
UpgradeDecision_getAggregateValue
(
"Software Release"
).
\
getUrlString
())
self
.
tic
()
up_decision2
=
instance_tree
.
InstanceTree_createUpgradeDecision
()
...
...
@@ -331,7 +332,7 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
up_decision2
=
instance_tree
.
InstanceTree_createUpgradeDecision
()
self
.
assertEqual
(
up_decision2
.
getSimulationState
(),
'planned'
)
self
.
assertEqual
(
up_decision
.
getSimulationState
(),
'cancelled'
)
release
=
up_decision2
.
UpgradeDecision_get
SoftwareRelease
(
)
release
=
up_decision2
.
UpgradeDecision_get
AggregateValue
(
"Software Release"
)
self
.
assertEqual
(
release
.
getUrlString
(),
software_release3
.
getUrlString
())
...
...
@@ -414,7 +415,7 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
decision2
=
instance_tree
.
InstanceTree_createUpgradeDecision
()
self
.
assertEqual
(
decision2
.
getSimulationState
(),
'planned'
)
self
.
assertEqual
(
up_decision
.
getSimulationState
(),
'rejected'
)
release
=
decision2
.
UpgradeDecision_get
SoftwareRelease
(
)
release
=
decision2
.
UpgradeDecision_get
AggregateValue
(
"Software Release"
)
self
.
assertEqual
(
release
.
getUrlString
(),
software_release3
.
getUrlString
())
\ No newline at end of file
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMSkins.py
View file @
15af6f15
...
...
@@ -466,203 +466,6 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
found_software_release
=
upgrade_decision
.
UpgradeDecision_getSoftwareRelease
()
self
.
assertEqual
(
None
,
found_software_release
)
@
simulate
(
'InstanceTree_isUpgradePossible'
,
'software_release_url'
,
'return 1'
)
def
testUpgradeDecision_upgradeInstanceTree
(
self
):
person
=
self
.
_makePerson
()
instance_tree
=
self
.
_makeInstanceTree
()
instance_tree
.
edit
(
destination_section_value
=
person
.
getRelativeUrl
())
self
.
_makeSoftwareInstance
(
instance_tree
,
instance_tree
.
getUrlString
())
software_release
=
self
.
_makeSoftwareRelease
()
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
(
[
software_release
,
instance_tree
])
self
.
tic
()
slap_state
=
instance_tree
.
getSlapState
()
self
.
assertFalse
(
upgrade_decision
.
UpgradeDecision_upgradeInstanceTree
())
self
.
assertNotEqual
(
software_release
.
getUrlString
(),
instance_tree
.
getUrlString
())
upgrade_decision
.
confirm
()
upgrade_decision
.
start
()
# Check that url_string change, but slap state doesn't
self
.
assertNotEqual
(
software_release
.
getUrlString
(),
instance_tree
.
getUrlString
())
self
.
assertTrue
(
upgrade_decision
.
UpgradeDecision_upgradeInstanceTree
())
self
.
assertEqual
(
software_release
.
getUrlString
(),
instance_tree
.
getUrlString
())
self
.
assertEqual
(
slap_state
,
instance_tree
.
getSlapState
())
self
.
assertEqual
(
'stopped'
,
upgrade_decision
.
getSimulationState
())
@
simulate
(
'InstanceTree_isUpgradePossible'
,
'software_release_url'
,
'return 1'
)
def
testUpgradeDecision_processUpgradeeInstanceTree
(
self
):
person
=
self
.
_makePerson
()
instance_tree
=
self
.
_makeInstanceTree
()
instance_tree
.
edit
(
destination_section_value
=
person
.
getRelativeUrl
())
self
.
_makeSoftwareInstance
(
instance_tree
,
instance_tree
.
getUrlString
())
software_release
=
self
.
_makeSoftwareRelease
()
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
(
[
software_release
,
instance_tree
])
self
.
tic
()
slap_state
=
instance_tree
.
getSlapState
()
self
.
assertFalse
(
upgrade_decision
.
UpgradeDecision_processUpgrade
())
self
.
assertNotEqual
(
software_release
.
getUrlString
(),
instance_tree
.
getUrlString
())
upgrade_decision
.
confirm
()
upgrade_decision
.
start
()
# Check that url_string change, but slap state doesn't
self
.
assertNotEqual
(
software_release
.
getUrlString
(),
instance_tree
.
getUrlString
())
self
.
assertTrue
(
upgrade_decision
.
UpgradeDecision_processUpgrade
())
self
.
assertEqual
(
software_release
.
getUrlString
(),
instance_tree
.
getUrlString
())
self
.
assertEqual
(
slap_state
,
instance_tree
.
getSlapState
())
self
.
assertEqual
(
'stopped'
,
upgrade_decision
.
getSimulationState
())
def
testUpgradeDecision_upgradeInstanceTree_no_software_release
(
self
):
person
=
self
.
_makePerson
()
instance_tree
=
self
.
_makeInstanceTree
()
instance_tree
.
edit
(
destination_section_value
=
person
.
getRelativeUrl
())
self
.
_makeSoftwareInstance
(
instance_tree
,
instance_tree
.
getUrlString
())
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
instance_tree
])
self
.
tic
()
upgrade_decision
.
confirm
()
upgrade_decision
.
start
()
self
.
assertFalse
(
upgrade_decision
.
UpgradeDecision_upgradeInstanceTree
())
self
.
assertEqual
(
'started'
,
upgrade_decision
.
getSimulationState
())
def
testUpgradeDecision_upgradeInstanceTree_no_hosting_subscripion
(
self
):
software_release
=
self
.
_makeSoftwareRelease
()
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
])
self
.
tic
()
upgrade_decision
.
confirm
()
upgrade_decision
.
start
()
self
.
assertFalse
(
upgrade_decision
.
UpgradeDecision_upgradeInstanceTree
())
self
.
assertEqual
(
'started'
,
upgrade_decision
.
getSimulationState
())
def
testUpgradeDecision_upgradeComputeNode_no_software_release
(
self
):
person
=
self
.
_makePerson
()
compute_node
,
_
=
self
.
_makeComputeNode
(
owner
=
person
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
compute_node
])
self
.
tic
()
upgrade_decision
.
confirm
()
upgrade_decision
.
start
()
self
.
assertFalse
(
upgrade_decision
.
UpgradeDecision_upgradeComputeNode
())
self
.
assertEqual
(
'started'
,
upgrade_decision
.
getSimulationState
())
def
testUpgradeDecision_upgradeComputeNode_no_hosting_subscripion
(
self
):
software_release
=
self
.
_makeSoftwareRelease
()
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
])
self
.
tic
()
upgrade_decision
.
confirm
()
upgrade_decision
.
start
()
self
.
assertFalse
(
upgrade_decision
.
UpgradeDecision_upgradeComputeNode
())
self
.
assertEqual
(
'started'
,
upgrade_decision
.
getSimulationState
())
def
testUpgradeDecision_upgradeComputeNode
(
self
):
self
.
_makePerson
()
compute_node
,
_
=
self
.
_makeComputeNode
()
software_release
=
self
.
_makeSoftwareRelease
()
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
,
compute_node
])
url
=
software_release
.
getUrlString
()
self
.
tic
()
self
.
assertFalse
(
upgrade_decision
.
UpgradeDecision_upgradeComputeNode
())
upgrade_decision
.
confirm
()
upgrade_decision
.
start
()
self
.
assertTrue
(
upgrade_decision
.
UpgradeDecision_upgradeComputeNode
())
self
.
tic
()
software_installation
=
compute_node
.
getAggregateRelatedValue
(
portal_type
=
'Software Installation'
)
self
.
assertEqual
(
'start_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
url
,
software_installation
.
getUrlString
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'stopped'
,
upgrade_decision
.
getSimulationState
())
def
testUpgradeDecision_processUpgradeComputeNode
(
self
):
self
.
_makePerson
()
compute_node
,
_
=
self
.
_makeComputeNode
()
software_release
=
self
.
_makeSoftwareRelease
()
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
,
compute_node
])
url
=
software_release
.
getUrlString
()
self
.
tic
()
self
.
assertFalse
(
upgrade_decision
.
UpgradeDecision_processUpgrade
())
upgrade_decision
.
confirm
()
upgrade_decision
.
start
()
self
.
assertTrue
(
upgrade_decision
.
UpgradeDecision_processUpgrade
())
self
.
tic
()
software_installation
=
compute_node
.
getAggregateRelatedValue
(
portal_type
=
'Software Installation'
)
self
.
assertEqual
(
'start_requested'
,
software_installation
.
getSlapState
())
self
.
assertEqual
(
url
,
software_installation
.
getUrlString
())
self
.
assertEqual
(
'validated'
,
software_installation
.
getValidationState
())
self
.
assertEqual
(
'stopped'
,
upgrade_decision
.
getSimulationState
())
def
testSoftwareRelease_createUpgradeDecision_compute_node
(
self
):
person
=
self
.
_makePerson
()
compute_node
,
_
=
self
.
_makeComputeNode
(
owner
=
person
)
...
...
@@ -895,54 +698,6 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
self
.
assertEqual
(
in_progress
,
None
)
def
testUpgradeDecision_tryToCancel
(
self
):
compute_node
,
_
=
self
.
_makeComputeNode
()
software_release
=
self
.
_makeSoftwareRelease
()
software_release2
=
self
.
_makeSoftwareRelease
()
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
,
compute_node
])
upgrade_decision
.
confirm
()
upgrade_decision2
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line2
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision2
)
upgrade_decision_line2
.
setAggregateValueList
([
software_release
,
compute_node
])
upgrade_decision2
.
confirm
()
upgrade_decision2
.
start
()
url
=
software_release
.
getUrlString
()
url2
=
software_release2
.
getUrlString
()
# Cancel is not possible with the same url_string
self
.
assertEqual
(
upgrade_decision
.
UpgradeDecision_tryToCancel
(
url
),
False
)
self
.
assertEqual
(
upgrade_decision
.
UpgradeDecision_tryToCancel
(
url2
),
True
)
self
.
assertEqual
(
upgrade_decision
.
getSimulationState
(),
'cancelled'
)
# Cancel is no longer possible
self
.
assertEqual
(
upgrade_decision2
.
UpgradeDecision_tryToCancel
(
url
),
False
)
self
.
assertEqual
(
upgrade_decision2
.
UpgradeDecision_tryToCancel
(
url2
),
False
)
self
.
assertEqual
(
upgrade_decision2
.
getSimulationState
(),
'started'
)
def
testUpgradeDecision_tryToCancel_withRejected
(
self
):
compute_node
,
_
=
self
.
_makeComputeNode
()
software_release
=
self
.
_makeSoftwareRelease
()
software_release2
=
self
.
_makeSoftwareRelease
()
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
,
compute_node
])
upgrade_decision
.
confirm
()
upgrade_decision
.
reject
()
url
=
software_release
.
getUrlString
()
url2
=
software_release2
.
getUrlString
()
# Try to cancel rejected UD with the same sr will return False
self
.
assertEqual
(
upgrade_decision
.
UpgradeDecision_tryToCancel
(
url
),
False
)
self
.
assertEqual
(
upgrade_decision
.
getSimulationState
(),
'rejected'
)
# Try to cancel rejected UD will return True with url2
self
.
assertEqual
(
upgrade_decision
.
UpgradeDecision_tryToCancel
(
url2
),
True
)
self
.
assertEqual
(
upgrade_decision
.
getSimulationState
(),
'rejected'
)
def
testComputeNode_checkAndCreateUpgradeDecision_auto
(
self
):
person
=
self
.
_makePerson
()
compute_node
,
_
=
self
.
_makeComputeNode
(
owner
=
person
,
...
...
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow.xml
0 → 100644
View file @
15af6f15
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Workflow"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_count
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_mt_index
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_tree
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
source/portal_workflow/upgrade_slap_interface_workflow/state_draft
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
person_slap_interface_workflow
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
upgrade_slap_interface_workflow
</string>
</value>
</item>
<item>
<key>
<string>
language
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
manager_bypass
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Workflow
</string>
</value>
</item>
<item>
<key>
<string>
state_variable
</string>
</key>
<value>
<string>
slap_state
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Upgrade Slap Interface Workflow
</string>
</value>
</item>
<item>
<key>
<string>
workflow_managed_permission
</string>
</key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Length"
module=
"BTrees.Length"
/>
</pickle>
<pickle>
<int>
0
</int>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_approveRegistration.py
0 → 100644
View file @
15af6f15
upgrade_decision
=
state_change
[
"object"
]
from
DateTime
import
DateTime
portal
=
upgrade_decision
.
getPortalObject
()
document
=
upgrade_decision
.
UpgradeDecision_getAggregateValue
(
"Instance Tree"
)
if
document
is
None
:
document
=
upgrade_decision
.
UpgradeDecision_getAggregateValue
(
"Compute Node"
)
if
document
is
None
:
raise
ValueError
(
"No Compute Node or Instance Tree associated to upgrade."
)
# Get required arguments
kwargs
=
state_change
.
kwargs
# Required args
# Raise TypeError if all parameters are not provided
try
:
upgrade_scope
=
kwargs
[
'upgrade_scope'
]
except
KeyError
:
raise
TypeError
(
"UpgradeDecision_approveRegistration takes exactly 1 arguments"
)
tag
=
"%s_requestUpgradeDecisionCreation_inProgress"
%
document
.
getUid
()
activate_kw
=
{
'tag'
:
tag
}
if
portal
.
portal_activities
.
countMessageWithTag
(
tag
)
>
0
:
# nothing to do
return
with
upgrade_decision
.
defaultActivateParameterDict
(
activate_kw
):
if
upgrade_decision
.
getSimulationState
()
==
"draft"
:
upgrade_decision
.
plan
()
upgrade_decision
.
setStartDate
(
DateTime
())
if
upgrade_scope
==
"auto"
:
if
upgrade_decision
.
getSimulationState
()
==
"planned"
:
upgrade_decision
.
start
()
# Prevent concurrent transaction to create 2 upgrade decision for the same instance_tree
document
.
serialize
()
master/bt5/slapos_pdm/
SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_upgradeInstanceTree
.xml
→
master/bt5/slapos_pdm/
WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_approveRegistration
.xml
View file @
15af6f15
...
...
@@ -2,7 +2,7 @@
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"
PythonScript"
module=
"Products.PythonScripts.PythonScript
"
/>
<global
name=
"
Workflow Script"
module=
"erp5.portal_type
"
/>
</pickle>
<pickle>
<dictionary>
...
...
@@ -50,11 +50,33 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
state_change
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
UpgradeDecision_upgradeInstanceTree
</string>
</value>
<value>
<string>
script_UpgradeDecision_approveRegistration
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Workflow Script
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
UpgradeDecision_approveRegistration
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_checkConsistency.py
0 → 100644
View file @
15af6f15
upgrade_decision
=
state_change
[
'object'
]
upgrade_decision
.
Base_checkConsistency
()
master/bt5/slapos_pdm/
SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_upgradeComputeNode
.xml
→
master/bt5/slapos_pdm/
WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_checkConsistency
.xml
View file @
15af6f15
...
...
@@ -2,7 +2,7 @@
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"
PythonScript"
module=
"Products.PythonScripts.PythonScript
"
/>
<global
name=
"
Workflow Script"
module=
"erp5.portal_type
"
/>
</pickle>
<pickle>
<dictionary>
...
...
@@ -50,11 +50,27 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
state_change
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
UpgradeDecision_upgradeComputeNode
</string>
</value>
<value>
<string>
script_UpgradeDecision_checkConsistency
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Workflow Script
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
...
...
master/bt5/slapos_pdm/
SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_upgradeInstanceTre
e.py
→
master/bt5/slapos_pdm/
WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_requestUpgrad
e.py
View file @
15af6f15
if
context
.
getSimulationState
()
!=
'started'
:
upgrade_decision
=
state_change
[
"object"
]
from
DateTime
import
DateTime
if
upgrade_decision
.
getSimulationState
()
!=
'started'
:
# Update Decision is not on started state, Upgrade is not possible!
return
False
return
instance_tree
=
upgrade_decision
.
UpgradeDecision_getAggregateValue
(
"Instance Tree"
)
software_release
=
upgrade_decision
.
UpgradeDecision_getAggregateValue
(
"Software Release"
)
compute_node
=
upgrade_decision
.
UpgradeDecision_getAggregateValue
(
"Compute Node"
)
i
nstance_tree
=
context
.
UpgradeDecision_getAggregateValue
(
"Instance Tree"
)
software_release
=
context
.
UpgradeDecision_getSoftwareRelease
()
i
f
software_release
is
None
:
return
if
instance_tree
is
None
:
return
False
if
compute_node
is
None
and
instance_tree
is
None
:
return
if
software_release
is
None
:
r
eturn
False
if
compute_node
is
not
None
and
instance_tree
is
not
None
:
r
aise
ValueError
(
"Something is wrong, you cannot upgrade Compute Node and Instance Tree on the same decision."
)
software_release_url
=
software_release
.
getUrlString
()
person
=
instance_tree
.
getDestinationSectionValue
(
portal_type
=
"Person"
)
if
compute_node
is
not
None
:
compute_node
.
requestSoftwareRelease
(
software_release_url
=
software_release_url
,
state
=
"available"
)
upgrade_decision
.
stop
(
comment
=
"Upgrade Processed for the Compute Node!"
)
return
# Test if the Software is available at the ComputeNode.
if
not
instance_tree
.
InstanceTree_isUpgradePossible
(
...
...
@@ -28,6 +41,7 @@ elif status == "stop_requested":
elif
status
==
"destroy_requested"
:
state
=
"destroyed"
person
=
instance_tree
.
getDestinationSectionValue
(
portal_type
=
"Person"
)
person
.
requestSoftwareInstance
(
state
=
state
,
software_release
=
software_release_url
,
...
...
@@ -38,6 +52,5 @@ person.requestSoftwareInstance(
shared
=
instance_tree
.
isRootSlave
()
)
context
.
stop
()
return
True
upgrade_decision
.
stop
(
comment
=
"Upgrade Processed for the Instance Tree!"
)
master/bt5/slapos_pdm/
SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_process
Upgrade.xml
→
master/bt5/slapos_pdm/
WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_request
Upgrade.xml
View file @
15af6f15
...
...
@@ -2,7 +2,7 @@
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"
PythonScript"
module=
"Products.PythonScripts.PythonScript
"
/>
<global
name=
"
Workflow Script"
module=
"erp5.portal_type
"
/>
</pickle>
<pickle>
<dictionary>
...
...
@@ -50,11 +50,33 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
<value>
<string>
state_change
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
UpgradeDecision_processUpgrade
</string>
</value>
<value>
<string>
script_UpgradeDecision_requestUpgrade
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Workflow Script
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
UpgradeDecision_requestUpgrade
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
master/bt5/slapos_pdm/
SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_tryToCancel
.py
→
master/bt5/slapos_pdm/
WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_reviewRegistration
.py
View file @
15af6f15
upgrade_decision
=
context
upgrade_decision
=
state_change
[
"object"
]
from
DateTime
import
DateTime
cancellable_state_list
=
[
'confirmed'
,
'planned'
]
require_state_list
=
[
'rejected'
,
'confirmed'
,
'planned'
]
simulation_state
=
upgrade_decision
.
getSimulationState
()
# Get required arguments
kwargs
=
state_change
.
kwargs
# Required args
# Raise TypeError if all parameters are not provided
try
:
software_release_url
=
kwargs
[
'software_release_url'
]
except
KeyError
:
raise
TypeError
(
"UpgradeDecision_reviewRegistration takes exactly 1 arguments"
)
if
simulation_state
in
require_state_list
:
current_release
=
upgrade_decision
.
UpgradeDecision_get
SoftwareRelease
(
)
current_release
=
upgrade_decision
.
UpgradeDecision_get
AggregateValue
(
"Software Release"
)
if
not
current_release
:
# This upgrade decision is not valid
return
False
instance_tree
=
context
.
UpgradeDecision_getAggregateValue
(
"Instance Tree"
)
return
instance_tree
=
upgrade_decision
.
UpgradeDecision_getAggregateValue
(
"Instance Tree"
)
if
instance_tree
is
not
None
:
current_instance_tree_release
=
instance_tree
.
getUrlString
()
if
current_instance_tree_release
==
new_url_string
:
if
current_instance_tree_release
==
software_release_url
:
if
simulation_state
in
cancellable_state_list
:
upgrade_decision
.
cancel
()
return
True
return
if
current_release
.
getUrlString
()
==
new_url_string
:
if
current_release
.
getUrlString
()
==
software_release_url
:
# Cannot cancel because the software releases are the same
return
False
if
simulation_state
in
cancellable_state_list
:
upgrade_decision
.
cancel
()
return
True
else
:
return
False
return
master/bt5/slapos_pdm/
SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getSoftwareRelease
.xml
→
master/bt5/slapos_pdm/
WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_reviewRegistration
.xml
View file @
15af6f15
...
...
@@ -2,7 +2,7 @@
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"
PythonScript"
module=
"Products.PythonScripts.PythonScript
"
/>
<global
name=
"
Workflow Script"
module=
"erp5.portal_type
"
/>
</pickle>
<pickle>
<dictionary>
...
...
@@ -50,11 +50,33 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
state_change
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
UpgradeDecision_getSoftwareRelease
</string>
</value>
<value>
<string>
script_UpgradeDecision_reviewRegistration
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Workflow Script
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
UpgradeDecision_reviewRegistration
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/state_draft.xml
0 → 100644
View file @
15af6f15
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Workflow State"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
acquire_permission
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
destination/portal_workflow/upgrade_slap_interface_workflow/transition_approve_registration
</string>
<string>
destination/portal_workflow/upgrade_slap_interface_workflow/transition_requestUpgrade
</string>
<string>
destination/portal_workflow/upgrade_slap_interface_workflow/transition_review_registration
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
state_draft
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Workflow State
</string>
</value>
</item>
<item>
<key>
<string>
state_permission_role_list_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
state_type
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Draft
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/transition_approve_registration.xml
0 → 100644
View file @
15af6f15
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Workflow Transition"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
action_name
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
action_type/workflow
</string>
<string>
before_script/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_checkConsistency
</string>
<string>
after_script/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_approveRegistration
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
guard_permission
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
icon
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
transition_approve_registration
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Workflow Transition
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Approve Registration
</string>
</value>
</item>
<item>
<key>
<string>
trigger_type
</string>
</key>
<value>
<int>
2
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/transition_requestUpgrade.xml
0 → 100644
View file @
15af6f15
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Workflow Transition"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
action_name
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
action_type/workflow
</string>
<string>
before_script/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_checkConsistency
</string>
<string>
after_script/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_requestUpgrade
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
Perform the Upgrade
</string>
</value>
</item>
<item>
<key>
<string>
guard_permission
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
icon
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
transition_requestUpgrade
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Workflow Transition
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Request Upgrade
</string>
</value>
</item>
<item>
<key>
<string>
trigger_type
</string>
</key>
<value>
<int>
2
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/transition_review_registration.xml
0 → 100644
View file @
15af6f15
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Workflow Transition"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
action_name
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
action_type/workflow
</string>
<string>
before_script/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_checkConsistency
</string>
<string>
after_script/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_reviewRegistration
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
Cancel if the upgrade is outdated
</string>
</value>
</item>
<item>
<key>
<string>
guard_permission
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
icon
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
transition_review_registration
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Workflow Transition
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Review Registration
</string>
</value>
</item>
<item>
<key>
<string>
trigger_type
</string>
</key>
<value>
<int>
2
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/variable_action.xml
0 → 100644
View file @
15af6f15
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Workflow Variable"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
automatic_update
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
The last transition
</string>
</value>
</item>
<item>
<key>
<string>
for_catalog
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
variable_action
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Workflow Variable
</string>
</value>
</item>
<item>
<key>
<string>
status_included
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
variable_default_expression
</string>
</key>
<value>
<string>
transition/getReference|nothing
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/variable_actor.xml
0 → 100644
View file @
15af6f15
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Workflow Variable"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
automatic_update
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
The name of the user who performed the last transition
</string>
</value>
</item>
<item>
<key>
<string>
for_catalog
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
variable_actor
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Workflow Variable
</string>
</value>
</item>
<item>
<key>
<string>
status_included
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
variable_default_expression
</string>
</key>
<value>
<string>
user/getUserName
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/variable_comment.xml
0 → 100644
View file @
15af6f15
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Workflow Variable"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
automatic_update
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
Comments about the last transition
</string>
</value>
</item>
<item>
<key>
<string>
for_catalog
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
variable_comment
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Workflow Variable
</string>
</value>
</item>
<item>
<key>
<string>
status_included
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
variable_default_expression
</string>
</key>
<value>
<string>
python:state_change.kwargs.get(\'comment\', \'\')
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/variable_error_message.xml
0 → 100644
View file @
15af6f15
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Workflow Variable"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
automatic_update
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
Error message if validation failed
</string>
</value>
</item>
<item>
<key>
<string>
for_catalog
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
variable_error_message
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Workflow Variable
</string>
</value>
</item>
<item>
<key>
<string>
status_included
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/variable_history.xml
0 → 100644
View file @
15af6f15
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Workflow Variable"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
automatic_update
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
Provides access to workflow history
</string>
</value>
</item>
<item>
<key>
<string>
for_catalog
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
variable_history
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Workflow Variable
</string>
</value>
</item>
<item>
<key>
<string>
status_included
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
variable_default_expression
</string>
</key>
<value>
<string>
state_change/getHistory
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/variable_portal_type.xml
0 → 100644
View file @
15af6f15
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Workflow Variable"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
automatic_update
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
portal type (use as filter for worklists)
</string>
</value>
</item>
<item>
<key>
<string>
for_catalog
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
variable_portal_type
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Workflow Variable
</string>
</value>
</item>
<item>
<key>
<string>
status_included
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/variable_time.xml
0 → 100644
View file @
15af6f15
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Workflow Variable"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
automatic_update
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
Time of the last transition
</string>
</value>
</item>
<item>
<key>
<string>
for_catalog
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
variable_time
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Workflow Variable
</string>
</value>
</item>
<item>
<key>
<string>
status_included
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
variable_default_expression
</string>
</key>
<value>
<string>
state_change/getDateTime
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_pdm/bt/template_portal_type_workflow_chain_list
View file @
15af6f15
...
...
@@ -3,3 +3,4 @@ Software Product | commerce_validation_workflow
Upgrade Decision | edit_workflow
Upgrade Decision | ticket_interaction_workflow
Upgrade Decision | upgrade_decision_workflow
Upgrade Decision | upgrade_slap_interface_workflow
\ No newline at end of file
master/bt5/slapos_pdm/bt/template_test_id_list
View file @
15af6f15
...
...
@@ -2,3 +2,4 @@ test.erp5.testSlapOSPDMAlarm
test.erp5.testSlapOSPDMSkins
test.erp5.testSlapOSPDMDestroySoftwareInstallationWithArchivedSoftwareReleaseAlarm
test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins
test.erp5.testSlapOSCloudUpgradeSlapInterfaceWorkflow
\ No newline at end of file
master/bt5/slapos_pdm/bt/template_workflow_id_list
View file @
15af6f15
upgrade_decision_workflow
upgrade_slap_interface_workflow
\ No newline at end of file
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