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
18
Merge Requests
18
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
nexedi
slapos.core
Commits
d40f0042
Commit
d40f0042
authored
Aug 05, 2014
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_pdm: Include tests and general fixes for Upgrade Decision
parent
2d0e0eeb
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
410 additions
and
54 deletions
+410
-54
master/bt5/slapos_pdm/PortalTypeTemplateItem/portal_types/Upgrade%20Decision.xml
...ortalTypeTemplateItem/portal_types/Upgrade%20Decision.xml
+6
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Base_acceptUpgradeDecision.xml
...em/portal_skins/slapos_pdm/Base_acceptUpgradeDecision.xml
+2
-2
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Base_rejectUpgradeDecision.xml
...em/portal_skins/slapos_pdm/Base_rejectUpgradeDecision.xml
+2
-2
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notify.xml
...teItem/portal_skins/slapos_pdm/UpgradeDecision_notify.xml
+31
-36
master/bt5/slapos_pdm/TestTemplateItem/testSlapOSPDMSkins.py
master/bt5/slapos_pdm/TestTemplateItem/testSlapOSPDMSkins.py
+366
-13
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_decision_workflow/states/draft.xml
...ortal_workflow/upgrade_decision_workflow/states/draft.xml
+2
-0
master/bt5/slapos_pdm/bt/revision
master/bt5/slapos_pdm/bt/revision
+1
-1
No files found.
master/bt5/slapos_pdm/PortalTypeTemplateItem/portal_types/Upgrade%20Decision.xml
View file @
d40f0042
...
@@ -22,6 +22,12 @@
...
@@ -22,6 +22,12 @@
<key>
<string>
factory
</string>
</key>
<key>
<string>
factory
</string>
</key>
<value>
<string>
addXMLObject
</string>
</value>
<value>
<string>
addXMLObject
</string>
</value>
</item>
</item>
<item>
<key>
<string>
group_list
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
Upgrade Decision
</string>
</value>
<value>
<string>
Upgrade Decision
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Base_acceptUpgradeDecision.xml
View file @
d40f0042
...
@@ -61,7 +61,7 @@ upgrade_decision_list = portal.portal_catalog(\n
...
@@ -61,7 +61,7 @@ upgrade_decision_list = portal.portal_catalog(\n
portal_type="Upgrade Decision", \n
portal_type="Upgrade Decision", \n
reference=reference, limit=2)\n
reference=reference, limit=2)\n
\n
\n
if
upgrade_decision_list is None
:\n
if
not len(upgrade_decision_list)
:\n
return context.Base_redirect("", \n
return context.Base_redirect("", \n
keep_items={"portal_status_message": \n
keep_items={"portal_status_message": \n
context.Base_translateString("Unable to find the Upgrade Decision.")})\n
context.Base_translateString("Unable to find the Upgrade Decision.")})\n
...
@@ -74,7 +74,7 @@ upgrade_decision = upgrade_decision_list[0]\n
...
@@ -74,7 +74,7 @@ upgrade_decision = upgrade_decision_list[0]\n
if upgrade_decision.getSimulationState() in [\'draft\', \'planned\']:\n
if upgrade_decision.getSimulationState() in [\'draft\', \'planned\']:\n
message = "Sorry, the upgrade is not possible yet!"\n
message = "Sorry, the upgrade is not possible yet!"\n
\n
\n
elif upgrade_decision.getSimulationState() in [\'cancel\', \'rejected\']:\n
elif upgrade_decision.getSimulationState() in [\'cancel
led
\', \'rejected\']:\n
message = "Sorry, the upgrade is not possble, Upgrade Decision was Canceled or Rejected!"\n
message = "Sorry, the upgrade is not possble, Upgrade Decision was Canceled or Rejected!"\n
\n
\n
elif upgrade_decision.getSimulationState() == \'started\':\n
elif upgrade_decision.getSimulationState() == \'started\':\n
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Base_rejectUpgradeDecision.xml
View file @
d40f0042
...
@@ -61,7 +61,7 @@ upgrade_decision_list = portal.portal_catalog(\n
...
@@ -61,7 +61,7 @@ upgrade_decision_list = portal.portal_catalog(\n
portal_type="Upgrade Decision", \n
portal_type="Upgrade Decision", \n
reference=reference, limit=2)\n
reference=reference, limit=2)\n
\n
\n
if
upgrade_decision_list is None
:\n
if
len(upgrade_decision_list) == 0
:\n
return context.Base_redirect("", \n
return context.Base_redirect("", \n
keep_items={"portal_status_message": \n
keep_items={"portal_status_message": \n
context.Base_translateString("Unable to find the Upgrade Decision.")})\n
context.Base_translateString("Unable to find the Upgrade Decision.")})\n
...
@@ -72,7 +72,7 @@ if len(upgrade_decision_list) > 1:\n
...
@@ -72,7 +72,7 @@ if len(upgrade_decision_list) > 1:\n
upgrade_decision = upgrade_decision_list[0]\n
upgrade_decision = upgrade_decision_list[0]\n
\n
\n
\n
\n
if upgrade_decision.getSimulationState() in [\'cancel\', \'rejected\']:\n
if upgrade_decision.getSimulationState() in [\'cancel
led
\', \'rejected\']:\n
message = "Upgrade Decision is already Rejected!"\n
message = "Upgrade Decision is already Rejected!"\n
\n
\n
elif upgrade_decision.getSimulationState() == \'started\':\n
elif upgrade_decision.getSimulationState() == \'started\':\n
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notify.xml
View file @
d40f0042
...
@@ -52,6 +52,10 @@
...
@@ -52,6 +52,10 @@
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from DateTime import DateTime\n
<value>
<string>
from DateTime import DateTime\n
\n
\n
if context.getSimulationState() != \'planned\':\n
# XXX Don\'t notify the ones which are not planned.\n
return \n
\n
portal = context.getPortalObject()\n
portal = context.getPortalObject()\n
\n
\n
person = context.getDestinationDecisionValue(portal_type="Person")\n
person = context.getDestinationDecisionValue(portal_type="Person")\n
...
@@ -65,50 +69,41 @@ software_product_title = software_release.getAggregateTitle(\n
...
@@ -65,50 +69,41 @@ software_product_title = software_release.getAggregateTitle(\n
portal_type="Software Product")\n
portal_type="Software Product")\n
reference = context.getReference()\n
reference = context.getReference()\n
\n
\n
if hosting_subscription is not None:\n
mapping_dict = {\n
\n
\'software_product_title\': software_product_title,\n
notification_message = portal.portal_notifications.getDocumentValue(\n
\'upgrade_accept_link\': \'Base_acceptUpgradeDecision?reference=%s\' % reference,\n
reference=\'slapos-upgrade-hosting-subscription.notification\')\n
\'upgrade_reject_link\': \'Base_rejectUpgradeDecision?reference=%s\' % reference,\n
\'software_release_name\': software_release.getTitle(),\n
\'software_release_reference\': software_release.getReference(),\n
\'new_software_release_url\': software_release.getUrlString(),\n
\n
\n
}\n
if hosting_subscription is not None:\n
notification_message_reference = \'slapos-upgrade-hosting-subscription.notification\'\n
title = "New Upgrade available for %s" % hosting_subscription.getTitle()\n
title = "New Upgrade available for %s" % hosting_subscription.getTitle()\n
mapping_dict = {\'software_product_title\': software_product_title,\n
mapping_dict.update(**{\n
\'hosting_subscription_title\': hosting_subscription.getTitle(),\n
\'hosting_subscription_title\': hosting_subscription.getTitle(),\n
\'software_release_name\': software_release.getTitle(),\n
\'old_software_release_url\': hosting_subscription.getUrlString()})\n
\'software_release_reference\': software_release.getReference(),\n
\'upgrade_accept_link\': \n
\'Base_acceptUpgradeDecision?reference=%s\' % reference,\n
\'upgrade_reject_link\':\n
\'Base_rejectUpgradeDecision?reference=%s\' % reference,\n
\'old_software_release_url\': hosting_subscription.getUrlString(),\n
\'new_software_release_url\': software_release.getUrlString(),\n
}\n
\n
\n
\n
\n
elif computer is not None:\n
elif computer is not None:\n
\n
\n
notification_message = portal.portal_notifications.getDocumentValue(\n
notification_message_reference = \'slapos-upgrade-computer.notification\' \n
reference=\'slapos-upgrade-computer.notification\')\n
\n
\n
title = "New Software available for Installation at %s" % computer.getTitle()\n
computer = "New Software available for Installation at %s" % computer.getTitle()\n
mapping_dict.update(**{\'computer_title\': computer.getTitle(),\n
mapping_dict = {\'software_product_title\': software_product_title,\n
\'computer_reference\': computer.getReference()})\n
\'computer_title\': computer.getTitle(),\n
\n
\'computer_reference\': computer.getReference(),\n
\n
\'software_release_name\': software_release.getTitle(),\n
if notification_message_reference is None:\n
\'software_release_reference\': software_release.getReference(),\n
\'upgrade_accept_link\': \n
\'Base_acceptUpgradeDecision?reference=%s\' % reference,\n
\'upgrade_reject_link\':\n
\'Base_rejectUpgradeDecision?reference=%s\' % reference,\n
\'new_software_release_url\': software_release.getUrlString(),\n
}\n
\n
\n
if notification_message is not None:\n
message = notification_message.asEntireHTML(\n
substitution_method_parameter_dict={\'mapping_dict\': mapping_dict})\n
else:\n
raise ValueError("No Notification Message")\n
raise ValueError("No Notification Message")\n
\n
\n
notification_message = portal.portal_notifications.getDocumentValue(\n
reference=notification_message_reference)\n
\n
message = notification_message.asEntireHTML(\n
substitution_method_parameter_dict={\'mapping_dict\': mapping_dict})\n
\n
event = context.SupportRequest_trySendNotificationMessage(title,\n
event = context.SupportRequest_trySendNotificationMessage(title,\n
message, person.getRelativeUrl())\n
message, person.getRelativeUrl())\n
\n
\n
...
...
master/bt5/slapos_pdm/TestTemplateItem/testSlapOSPDMSkins.py
View file @
d40f0042
This diff is collapsed.
Click to expand it.
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_decision_workflow/states/draft.xml
View file @
d40f0042
...
@@ -36,6 +36,8 @@
...
@@ -36,6 +36,8 @@
<string>
delete_action
</string>
<string>
delete_action
</string>
<string>
plan
</string>
<string>
plan
</string>
<string>
plan_action
</string>
<string>
plan_action
</string>
<string>
reject
</string>
<string>
reject_action
</string>
<string>
start
</string>
<string>
start
</string>
<string>
start_action
</string>
<string>
start_action
</string>
</tuple>
</tuple>
...
...
master/bt5/slapos_pdm/bt/revision
View file @
d40f0042
27
28
\ No newline at end of file
\ 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