Commit eb6cd0b3 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_pdm: Minor fixup on upgrade_slap_interface_workflow

parent 5f26ba4d
Pipeline #19303 failed with stage
in 0 seconds
......@@ -51,7 +51,8 @@ for software_release in software_release_list:
source_url=compute_node.getRelativeUrl(),
title=title)
upgrade_decision.approveRegistration(upgrade_scope=compute_node.getUpgradeScope("ask_confirmation"))
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
......@@ -62,6 +61,8 @@ upgrade_decision = newer_release.SoftwareRelease_createUpgradeDecision(
source_url=instance_tree.getRelativeUrl(),
title=decision_title
)
upgrade_decision.approveRegistration()
upgrade_decision.approveRegistration(
upgrade_scope=upgrade_scope)
return upgrade_decision
document_list = []
for decision_line in context.contentValues():
document_list.extend(
decision_line.getAggregateValueList(portal_type=document_portal_type))
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)
......
......@@ -14,7 +14,7 @@ kwargs = state_change.kwargs
try:
upgrade_scope = kwargs['upgrade_scope']
except KeyError:
raise TypeError("UpgradeDecision_reviewRegistration takes exactly 1 arguments")
raise TypeError("UpgradeDecision_approveRegistration takes exactly 1 arguments")
tag = "%s_requestUpgradeDecisionCreation_inProgress" % document.getUid()
activate_kw = {'tag': tag}
......@@ -31,4 +31,4 @@ with upgrade_decision.defaultActivateParameterDict(activate_kw):
upgrade_decision.start()
# Prevent concurrent transaction to create 2 upgrade decision for the same instance_tree
instance_tree.serialize()
document.serialize()
......@@ -22,7 +22,7 @@ if simulation_state in require_state_list:
# This upgrade decision is not valid
return
instance_tree = context.UpgradeDecision_getAggregateValue("Instance Tree")
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 == software_release_url:
......
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