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
74aa0db6
Commit
74aa0db6
authored
Jun 14, 2019
by
Thomas Gambier
🚴🏼
Committed by
Rafael Monnerat
Jun 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[slapos_pdm]: fix UpgradeDecisionLine_cancel
/reviewed-on
nexedi/slapos.core!117
parent
37d8708f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
106 additions
and
2 deletions
+106
-2
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecisionLine_cancel.py
...tem/portal_skins/slapos_pdm/UpgradeDecisionLine_cancel.py
+2
-1
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSPDMSkins.py
+104
-1
No files found.
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecisionLine_cancel.py
View file @
74aa0db6
...
...
@@ -5,7 +5,8 @@ software_release = context.getAggregateValue(portal_type="Software Release")
upgrade_decision
=
context
.
getParentValue
()
if
software_release
.
getValidationState
()
==
"archived"
:
upgrade_decision
.
cancel
(
comment
=
"Software Release is archived"
)
upgrade_decision
.
cancel
(
comment
=
"Software Release is archived."
)
return
if
hosting_subscription
is
not
None
:
if
hosting_subscription
.
getSlapState
()
==
"destroy_requested"
:
...
...
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMSkins.py
View file @
74aa0db6
...
...
@@ -1870,5 +1870,108 @@ ${new_software_release_url}""",
software_release
.
getUrlString
()])
self
.
assertEqual
(
event
.
getSimulationState
(),
"delivered"
)
def
testUpgradeDecisionLine_cancel_archived_software_release
(
self
):
software_release
=
self
.
_makeSoftwareRelease
()
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
])
self
.
tic
()
software_release
.
archive
()
upgrade_decision_line
.
UpgradeDecisionLine_cancel
()
self
.
assertEqual
(
'cancelled'
,
upgrade_decision
.
getSimulationState
())
workflow_history_list
=
upgrade_decision
.
Base_getWorkflowHistoryItemList
(
'upgrade_decision_workflow'
,
display
=
0
)
self
.
assertEqual
(
"Software Release is archived."
,
workflow_history_list
[
-
1
].
comment
)
@
simulate
(
'NotificationTool_getDocumentValue'
,
'reference=None'
,
'assert reference == "slapos-upgrade-delivered-computer.notification"
\
n
'
\
'return context.restrictedTraverse('
\
'context.REQUEST["testUpgradeDecisionLine_cancel_destroyed_hosting_subscription"])'
)
def
testUpgradeDecisionLine_cancel_destroyed_hosting_subscription
(
self
):
software_release
=
self
.
_makeSoftwareRelease
()
hosting_subscription
=
self
.
_makeFullHostingSubscription
(
software_release
.
getUrlString
())
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
,
hosting_subscription
])
notification_message
=
self
.
portal
.
notification_message_module
.
newContent
(
portal_type
=
"Notification Message"
,
title
=
'Test NM title %s'
%
self
.
new_id
,
text_content_substitution_mapping_method_id
=
"NotificationMessage_getSubstitutionMappingDictFromArgument"
,
text_content
=
"""${software_product_title}
${computer_title}
${computer_reference}
${software_release_name}
${software_release_reference}
${new_software_release_url}"""
,
content_type
=
'text/html'
,
)
self
.
portal
.
REQUEST
\
[
'testUpgradeDecisionLine_cancel_destroyed_hosting_subscription'
]
=
\
notification_message
.
getRelativeUrl
()
self
.
tic
()
kw
=
dict
(
software_release
=
hosting_subscription
.
getUrlString
(),
software_type
=
hosting_subscription
.
getSourceReference
(),
instance_xml
=
hosting_subscription
.
getTextContent
(),
sla_xml
=
self
.
generateSafeXml
(),
shared
=
False
)
hosting_subscription
.
requestDestroy
(
**
kw
)
self
.
tic
()
upgrade_decision_line
.
UpgradeDecisionLine_cancel
()
self
.
assertEqual
(
'cancelled'
,
upgrade_decision
.
getSimulationState
())
workflow_history_list
=
upgrade_decision
.
Base_getWorkflowHistoryItemList
(
'upgrade_decision_workflow'
,
display
=
0
)
self
.
assertEqual
(
"Hosting Subscription is destroyed."
,
workflow_history_list
[
-
1
].
comment
)
@
simulate
(
'NotificationTool_getDocumentValue'
,
'reference=None'
,
'assert reference == "slapos-upgrade-delivered-computer.notification"
\
n
'
\
'return context.restrictedTraverse('
\
'context.REQUEST["testUpgradeDecisionLine_cancel_destroyed_hs_archived_sr"])'
)
def
testUpgradeDecisionLine_cancel_destroyed_hs_archived_sr
(
self
):
software_release
=
self
.
_makeSoftwareRelease
()
hosting_subscription
=
self
.
_makeFullHostingSubscription
(
software_release
.
getUrlString
())
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
,
hosting_subscription
])
notification_message
=
self
.
portal
.
notification_message_module
.
newContent
(
portal_type
=
"Notification Message"
,
title
=
'Test NM title %s'
%
self
.
new_id
,
text_content_substitution_mapping_method_id
=
"NotificationMessage_getSubstitutionMappingDictFromArgument"
,
text_content
=
"""${software_product_title}
${computer_title}
${computer_reference}
${software_release_name}
${software_release_reference}
${new_software_release_url}"""
,
content_type
=
'text/html'
,
)
self
.
portal
.
REQUEST
\
[
'testUpgradeDecisionLine_cancel_destroyed_hs_archived_sr'
]
=
\
notification_message
.
getRelativeUrl
()
self
.
tic
()
kw
=
dict
(
software_release
=
hosting_subscription
.
getUrlString
(),
software_type
=
hosting_subscription
.
getSourceReference
(),
instance_xml
=
hosting_subscription
.
getTextContent
(),
sla_xml
=
self
.
generateSafeXml
(),
shared
=
False
)
hosting_subscription
.
requestDestroy
(
**
kw
)
software_release
.
archive
()
self
.
tic
()
upgrade_decision_line
.
UpgradeDecisionLine_cancel
()
self
.
assertEqual
(
'cancelled'
,
upgrade_decision
.
getSimulationState
())
workflow_history_list
=
upgrade_decision
.
Base_getWorkflowHistoryItemList
(
'upgrade_decision_workflow'
,
display
=
0
)
self
.
assertEqual
(
"Software Release is archived."
,
workflow_history_list
[
-
1
].
comment
)
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