Commit 15af6f15 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_pdm: Implement upgrade_slap_interface_workflow

parent 8b2bc6fd
Pipeline #19424 failed with stage
in 0 seconds
......@@ -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
......@@ -2,7 +2,7 @@ portal = context.getPortalObject()
portal.portal_catalog.searchAndActivate(
portal_type='Upgrade Decision',
simulation_state='started',
method_id='UpgradeDecision_processUpgrade',
method_id='requestUpgrade',
activate_kw={'tag': tag }
)
......
......@@ -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
......@@ -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
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)
......
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]
......@@ -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_getSoftwareRelease()
software_release = context.UpgradeDecision_getAggregateValue("Software Release")
if instance_tree is not None:
if instance_tree.getUrlString() == software_release.getUrlString():
......
from DateTime import DateTime
return
if context.getSimulationState() != 'planned':
# XXX Don't notify the ones which are not planned.
return
......
......@@ -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_getSoftwareRelease()
software_release = context.UpgradeDecision_getAggregateValue("Software Release")
software_product_title = software_release.getAggregateTitle(
portal_type="Software Product")
......
if context.UpgradeDecision_upgradeInstanceTree():
return True
if context.UpgradeDecision_upgradeComputeNode():
return True
return False
<?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>
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
# -*- 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())
<?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>
......@@ -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_getSoftwareRelease()
release = up_decision2.UpgradeDecision_getAggregateValue("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_getSoftwareRelease()
release = decision2.UpgradeDecision_getAggregateValue("Software Release")
self.assertEqual(release.getUrlString(),
software_release3.getUrlString())
\ No newline at end of file
......@@ -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,
......
<?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>
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()
......@@ -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>
......
......@@ -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>
......
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")
instance_tree = context.UpgradeDecision_getAggregateValue("Instance Tree")
software_release = context.UpgradeDecision_getSoftwareRelease()
if 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:
return False
if compute_node is not None and instance_tree is not None:
raise 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!")
......@@ -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>
......
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_getSoftwareRelease()
current_release = upgrade_decision.UpgradeDecision_getAggregateValue("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
......@@ -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>
......
<?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>
<?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>
<?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>
<?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>
<?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>
<?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>
<?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>
<?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>
<?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>
<?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>
<?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>
......@@ -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
......@@ -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
upgrade_decision_workflow
upgrade_slap_interface_workflow
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment