Commit d023bb2f authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_pdm: Clean up Upgrade decisions on draft and planned also

   This can prevent a useless message be pushed to the user.
parent 84616c70
...@@ -3,7 +3,7 @@ portal = context.getPortalObject() ...@@ -3,7 +3,7 @@ portal = context.getPortalObject()
portal.portal_catalog.searchAndActivate( portal.portal_catalog.searchAndActivate(
portal_type="Upgrade Decision Line", portal_type="Upgrade Decision Line",
simulation_state="confirmed", simulation_state=["confirmed", "draft", "planned"],
method_id = 'UpgradeDecisionLine_cancel', method_id = 'UpgradeDecisionLine_cancel',
activate_kw = {'tag':tag} activate_kw = {'tag':tag}
) )
......
...@@ -9,6 +9,9 @@ if software_release.getValidationState() == "archived": ...@@ -9,6 +9,9 @@ if software_release.getValidationState() == "archived":
return return
if hosting_subscription is not None: if hosting_subscription is not None:
if hosting_subscription.getUpgradeScope() in ['never', 'disabled']:
upgrade_decision.cancel("Upgrade scope was disabled on the related Hosting Subscription")
if hosting_subscription.getSlapState() == "destroy_requested": if hosting_subscription.getSlapState() == "destroy_requested":
upgrade_decision.cancel(comment="Hosting Subscription is destroyed.") upgrade_decision.cancel(comment="Hosting Subscription is destroyed.")
...@@ -19,6 +22,9 @@ if hosting_subscription is not None: ...@@ -19,6 +22,9 @@ if hosting_subscription is not None:
computer = context.getAggregateValue(portal_type="Computer") computer = context.getAggregateValue(portal_type="Computer")
if computer is not None: if computer is not None:
if computer.getUpgradeScope() in ['never', 'disabled']:
upgrade_decision.cancel("Upgrade scope was disabled on the related Hosting Subscription")
if computer.getAllocationScope() in ["closed/forever", "closed/termination"]: if computer.getAllocationScope() in ["closed/forever", "closed/termination"]:
upgrade_decision.cancel(comment="Computer is closed.") upgrade_decision.cancel(comment="Computer is closed.")
return return
...@@ -28,4 +34,4 @@ if computer is not None: ...@@ -28,4 +34,4 @@ if computer is not None:
parent_reference=computer.getReference(), parent_reference=computer.getReference(),
software_release_url=software_release.getUrlString())) software_release_url=software_release.getUrlString()))
if already_deployed: if already_deployed:
context.getParentValue().cancel(comment="Computer already has the software release") upgrade_decision.cancel(comment="Computer already has the software release")
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