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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
slapos.core
Commits
a2117809
Commit
a2117809
authored
Aug 14, 2014
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_pdm: Include script for confirm if Upgrade was already requested
parent
c106dded
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
2 deletions
+126
-2
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_isUpgradeFinished.xml
...al_skins/slapos_pdm/UpgradeDecision_isUpgradeFinished.xml
+93
-0
master/bt5/slapos_pdm/TestTemplateItem/testSlapOSPDMSkins.py
master/bt5/slapos_pdm/TestTemplateItem/testSlapOSPDMSkins.py
+32
-1
master/bt5/slapos_pdm/bt/revision
master/bt5/slapos_pdm/bt/revision
+1
-1
No files found.
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_isUpgradeFinished.xml
0 → 100644
View file @
a2117809
<?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>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
portal = context.getPortalObject()\n
\n
hosting_subscription = context.UpgradeDecision_getHostingSubscription()\n
computer = context.UpgradeDecision_getComputer()\n
software_release = context.UpgradeDecision_getSoftwareRelease()\n
\n
if hosting_subscription is not None:\n
if hosting_subscription.getUrlString() == software_release.getUrlString():\n
return True\n
\n
elif computer is not None:\n
full_software_release_list = [si for si in \n
portal.portal_catalog(\n
portal_type=\'Software Installation\',\n
url_string=software_release.getUrlString(),\n
default_aggregate_uid=computer.getUid(),\n
validation_state=\'validated\'\n
) if si.getSlapState() == \'start_requested\']\n
\n
if len(full_software_release_list) >
0:\n
return True\n
\n
return False\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
UpgradeDecision_isUpgradeFinished
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_pdm/TestTemplateItem/testSlapOSPDMSkins.py
View file @
a2117809
...
@@ -1394,6 +1394,37 @@ class TestSlapOSPDMSkins(testSlapOSMixin):
...
@@ -1394,6 +1394,37 @@ class TestSlapOSPDMSkins(testSlapOSMixin):
"?portal_status_message=Upgrade%20Decision%20is%20already%20Rejected%21"
),
"?portal_status_message=Upgrade%20Decision%20is%20already%20Rejected%21"
),
"%s contains the wrong message"
%
redirect_url
)
"%s contains the wrong message"
%
redirect_url
)
def
testUpgradeDecision_isUpgradeFinished_computer
(
self
):
computer
=
self
.
_makeComputer
(
self
.
new_id
)
software_release
=
self
.
_makeSoftwareRelease
(
self
.
new_id
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
,
computer
])
upgrade_decision
.
confirm
()
upgrade_decision
.
stop
()
self
.
assertFalse
(
upgrade_decision
.
UpgradeDecision_isUpgradeFinished
())
self
.
_makeSoftwareInstallation
(
self
.
new_id
,
computer
,
software_release
.
getUrlString
())
self
.
tic
()
self
.
assertTrue
(
upgrade_decision
.
UpgradeDecision_isUpgradeFinished
())
def
testUpgradeDecision_isUpgradeFinished_hosting_subscription
(
self
):
hosting_subscription
=
self
.
_makeHostingSubscription
(
self
.
new_id
)
software_release
=
self
.
_makeSoftwareRelease
(
self
.
new_id
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
,
hosting_subscription
])
upgrade_decision
.
confirm
()
upgrade_decision
.
stop
()
self
.
assertFalse
(
upgrade_decision
.
UpgradeDecision_isUpgradeFinished
())
hosting_subscription
.
setUrlString
(
software_release
.
getUrlString
())
self
.
assertTrue
(
upgrade_decision
.
UpgradeDecision_isUpgradeFinished
())
@
simulate
(
'NotificationTool_getDocumentValue'
,
@
simulate
(
'NotificationTool_getDocumentValue'
,
'reference=None'
,
'reference=None'
,
'assert reference == "slapos-upgrade-computer.notification"
\
n
'
\
'assert reference == "slapos-upgrade-computer.notification"
\
n
'
\
...
@@ -1524,4 +1555,4 @@ ${new_software_release_url}""",
...
@@ -1524,4 +1555,4 @@ ${new_software_release_url}""",
self
.
assertEquals
(
event
.
getSimulationState
(),
"delivered"
)
self
.
assertEquals
(
event
.
getSimulationState
(),
"delivered"
)
\ No newline at end of file
master/bt5/slapos_pdm/bt/revision
View file @
a2117809
3
4
3
5
\ 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