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
Xavier Thompson
slapos.core
Commits
4121077a
Commit
4121077a
authored
Apr 11, 2016
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migrate slapos_pdm business template to new format
parent
4fcc16cb
Changes
68
Hide whitespace changes
Inline
Side-by-side
Showing
68 changed files
with
792 additions
and
967 deletions
+792
-967
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_cancelUpgradeDestroyedHostingSubscription.py
...os_pdm/Alarm_cancelUpgradeDestroyedHostingSubscription.py
+11
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_cancelUpgradeDestroyedHostingSubscription.xml
...s_pdm/Alarm_cancelUpgradeDestroyedHostingSubscription.xml
+0
-15
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_computerCheckUpgradeHostingSubscription.py
...apos_pdm/Alarm_computerCheckUpgradeHostingSubscription.py
+17
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_computerCheckUpgradeHostingSubscription.xml
...pos_pdm/Alarm_computerCheckUpgradeHostingSubscription.xml
+0
-21
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_computerCheckUpgradeSoftwareRelease.py
...s/slapos_pdm/Alarm_computerCheckUpgradeSoftwareRelease.py
+17
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_computerCheckUpgradeSoftwareRelease.xml
.../slapos_pdm/Alarm_computerCheckUpgradeSoftwareRelease.xml
+0
-21
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_manageSoftwareCatalog.py
...em/portal_skins/slapos_pdm/Alarm_manageSoftwareCatalog.py
+9
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_manageSoftwareCatalog.xml
...m/portal_skins/slapos_pdm/Alarm_manageSoftwareCatalog.xml
+0
-13
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_processPlannedUpgradeDecision.py
...l_skins/slapos_pdm/Alarm_processPlannedUpgradeDecision.py
+9
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_processPlannedUpgradeDecision.xml
..._skins/slapos_pdm/Alarm_processPlannedUpgradeDecision.xml
+0
-13
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_processStartedUpgradeDecision.py
...l_skins/slapos_pdm/Alarm_processStartedUpgradeDecision.py
+9
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_processStartedUpgradeDecision.xml
..._skins/slapos_pdm/Alarm_processStartedUpgradeDecision.xml
+0
-13
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_processStoppedUpgradeDecision.py
...l_skins/slapos_pdm/Alarm_processStoppedUpgradeDecision.py
+9
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_processStoppedUpgradeDecision.xml
..._skins/slapos_pdm/Alarm_processStoppedUpgradeDecision.xml
+0
-13
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Base_acceptUpgradeDecision.py
...tem/portal_skins/slapos_pdm/Base_acceptUpgradeDecision.py
+38
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Base_acceptUpgradeDecision.xml
...em/portal_skins/slapos_pdm/Base_acceptUpgradeDecision.xml
+0
-46
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Base_rejectUpgradeDecision.py
...tem/portal_skins/slapos_pdm/Base_rejectUpgradeDecision.py
+36
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Base_rejectUpgradeDecision.xml
...em/portal_skins/slapos_pdm/Base_rejectUpgradeDecision.xml
+0
-44
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Computer_checkAndCreateUpgradeDecision.py
...kins/slapos_pdm/Computer_checkAndCreateUpgradeDecision.py
+56
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Computer_checkAndCreateUpgradeDecision.xml
...ins/slapos_pdm/Computer_checkAndCreateUpgradeDecision.xml
+0
-60
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Computer_hostingSubscriptionCreateUpgradeDecision.py
..._pdm/Computer_hostingSubscriptionCreateUpgradeDecision.py
+45
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Computer_hostingSubscriptionCreateUpgradeDecision.xml
...pdm/Computer_hostingSubscriptionCreateUpgradeDecision.xml
+0
-49
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/HostingSubscription_getNewerSofwareRelease.py
.../slapos_pdm/HostingSubscription_getNewerSofwareRelease.py
+16
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/HostingSubscription_getNewerSofwareRelease.xml
...slapos_pdm/HostingSubscription_getNewerSofwareRelease.xml
+0
-20
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/HostingSubscription_getUpgradableSoftwareRelease.py
...s_pdm/HostingSubscription_getUpgradableSoftwareRelease.py
+38
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/HostingSubscription_getUpgradableSoftwareRelease.xml
..._pdm/HostingSubscription_getUpgradableSoftwareRelease.xml
+1
-43
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/HostingSubscription_getUpgradeSubscriptionRelatedValue.py
...HostingSubscription_getUpgradeSubscriptionRelatedValue.py
+19
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/HostingSubscription_getUpgradeSubscriptionRelatedValue.xml
...ostingSubscription_getUpgradeSubscriptionRelatedValue.xml
+0
-27
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/SoftwareProduct_getSortedSoftwareReleaseList.py
...lapos_pdm/SoftwareProduct_getSortedSoftwareReleaseList.py
+56
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/SoftwareProduct_getSortedSoftwareReleaseList.xml
...apos_pdm/SoftwareProduct_getSortedSoftwareReleaseList.xml
+0
-64
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/SoftwareProduct_manageSoftwareCatalog.py
...skins/slapos_pdm/SoftwareProduct_manageSoftwareCatalog.py
+23
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/SoftwareProduct_manageSoftwareCatalog.xml
...kins/slapos_pdm/SoftwareProduct_manageSoftwareCatalog.xml
+0
-31
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/SoftwareRelease_createUpgradeDecision.py
...skins/slapos_pdm/SoftwareRelease_createUpgradeDecision.py
+42
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/SoftwareRelease_createUpgradeDecision.xml
...kins/slapos_pdm/SoftwareRelease_createUpgradeDecision.xml
+0
-50
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/SoftwareRelease_getUpgradeDecisionInProgress.py
...lapos_pdm/SoftwareRelease_getUpgradeDecisionInProgress.py
+26
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/SoftwareRelease_getUpgradeDecisionInProgress.xml
...apos_pdm/SoftwareRelease_getUpgradeDecisionInProgress.xml
+0
-34
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecisionLine_cancelDestroyed.py
...l_skins/slapos_pdm/UpgradeDecisionLine_cancelDestroyed.py
+3
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecisionLine_cancelDestroyed.xml
..._skins/slapos_pdm/UpgradeDecisionLine_cancelDestroyed.xml
+0
-7
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_afterClone.py
...tem/portal_skins/slapos_pdm/UpgradeDecision_afterClone.py
+1
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_afterClone.xml
...em/portal_skins/slapos_pdm/UpgradeDecision_afterClone.xml
+0
-5
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getComputer.py
...em/portal_skins/slapos_pdm/UpgradeDecision_getComputer.py
+13
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getComputer.xml
...m/portal_skins/slapos_pdm/UpgradeDecision_getComputer.xml
+0
-21
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getComputerNotificationMessage.py
...pos_pdm/UpgradeDecision_getComputerNotificationMessage.py
+26
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getComputerNotificationMessage.xml
...os_pdm/UpgradeDecision_getComputerNotificationMessage.xml
+0
-30
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getHostingSubscription.py
...kins/slapos_pdm/UpgradeDecision_getHostingSubscription.py
+13
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getHostingSubscription.xml
...ins/slapos_pdm/UpgradeDecision_getHostingSubscription.xml
+0
-21
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getResourceItemList.py
...l_skins/slapos_pdm/UpgradeDecision_getResourceItemList.py
+1
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getResourceItemList.xml
..._skins/slapos_pdm/UpgradeDecision_getResourceItemList.xml
+0
-5
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getSoftwareRelease.py
...al_skins/slapos_pdm/UpgradeDecision_getSoftwareRelease.py
+13
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getSoftwareRelease.xml
...l_skins/slapos_pdm/UpgradeDecision_getSoftwareRelease.xml
+0
-21
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_init.py
...plateItem/portal_skins/slapos_pdm/UpgradeDecision_init.py
+14
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_init.xml
...lateItem/portal_skins/slapos_pdm/UpgradeDecision_init.xml
+0
-18
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_isUpgradeFinished.py
...tal_skins/slapos_pdm/UpgradeDecision_isUpgradeFinished.py
+23
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_isUpgradeFinished.xml
...al_skins/slapos_pdm/UpgradeDecision_isUpgradeFinished.xml
+0
-31
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notify.py
...ateItem/portal_skins/slapos_pdm/UpgradeDecision_notify.py
+59
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notify.xml
...teItem/portal_skins/slapos_pdm/UpgradeDecision_notify.xml
+0
-63
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notifyDelivered.py
...ortal_skins/slapos_pdm/UpgradeDecision_notifyDelivered.py
+61
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notifyDelivered.xml
...rtal_skins/slapos_pdm/UpgradeDecision_notifyDelivered.xml
+0
-65
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_processUpgrade.py
...portal_skins/slapos_pdm/UpgradeDecision_processUpgrade.py
+7
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_processUpgrade.xml
...ortal_skins/slapos_pdm/UpgradeDecision_processUpgrade.xml
+0
-11
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_tryToCancel.py
...em/portal_skins/slapos_pdm/UpgradeDecision_tryToCancel.py
+18
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_tryToCancel.xml
...m/portal_skins/slapos_pdm/UpgradeDecision_tryToCancel.xml
+0
-22
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_upgradeComputer.py
...ortal_skins/slapos_pdm/UpgradeDecision_upgradeComputer.py
+22
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_upgradeComputer.xml
...rtal_skins/slapos_pdm/UpgradeDecision_upgradeComputer.xml
+0
-26
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_upgradeHostingSubscription.py
.../slapos_pdm/UpgradeDecision_upgradeHostingSubscription.py
+39
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_upgradeHostingSubscription.xml
...slapos_pdm/UpgradeDecision_upgradeHostingSubscription.xml
+0
-43
master/bt5/slapos_pdm/bt/template_path_list
master/bt5/slapos_pdm/bt/template_path_list
+1
-0
master/bt5/slapos_pdm/bt/template_test_id_list
master/bt5/slapos_pdm/bt/template_test_id_list
+1
-1
No files found.
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_cancelUpgradeDestroyedHostingSubscription.py
0 → 100644
View file @
4121077a
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
"Upgrade Decision Line"
,
simulation_state
=
"confirmed"
,
method_id
=
'UpgradeDecisionLine_cancelDestroyed'
,
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_cancelUpgradeDestroyedHostingSubscription.xml
View file @
4121077a
...
...
@@ -48,21 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
\n
\n
portal.portal_catalog.searchAndActivate(\n
portal_type="Upgrade Decision Line", \n
simulation_state="confirmed",\n
method_id = \'UpgradeDecisionLine_cancelDestroyed\',\n
activate_kw = {\'tag\':tag}\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_computerCheckUpgradeHostingSubscription.py
0 → 100644
View file @
4121077a
portal
=
context
.
getPortalObject
()
public_scope_uid
=
portal
.
restrictedTraverse
(
"portal_categories/allocation_scope/open/public"
,
None
).
getUid
()
friend_scope_uid
=
portal
.
restrictedTraverse
(
"portal_categories/allocation_scope/open/friend"
,
None
).
getUid
()
if
public_scope_uid
and
friend_scope_uid
:
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Computer'
,
validation_state
=
'validated'
,
default_allocation_scope_uid
=
[
public_scope_uid
,
friend_scope_uid
],
method_id
=
'Computer_hostingSubscriptionCreateUpgradeDecision'
,
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_computerCheckUpgradeHostingSubscription.xml
View file @
4121077a
...
...
@@ -48,27 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
\n
public_scope_uid = portal.restrictedTraverse(\n
"portal_categories/allocation_scope/open/public", None).getUid()\n
friend_scope_uid = portal.restrictedTraverse(\n
"portal_categories/allocation_scope/open/friend", None).getUid()\n
\n
if public_scope_uid and friend_scope_uid:\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Computer\',\n
validation_state = \'validated\',\n
default_allocation_scope_uid=[public_scope_uid, friend_scope_uid],\n
method_id = \'Computer_hostingSubscriptionCreateUpgradeDecision\',\n
activate_kw = {\'tag\':tag}\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_computerCheckUpgradeSoftwareRelease.py
0 → 100644
View file @
4121077a
portal
=
context
.
getPortalObject
()
public_scope_uid
=
portal
.
restrictedTraverse
(
"portal_categories/allocation_scope/open/public"
,
None
).
getUid
()
friend_scope_uid
=
portal
.
restrictedTraverse
(
"portal_categories/allocation_scope/open/friend"
,
None
).
getUid
()
if
public_scope_uid
and
friend_scope_uid
:
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Computer'
,
validation_state
=
'validated'
,
default_allocation_scope_uid
=
[
public_scope_uid
,
friend_scope_uid
],
method_id
=
'Computer_checkAndCreateUpgradeDecision'
,
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_computerCheckUpgradeSoftwareRelease.xml
View file @
4121077a
...
...
@@ -48,27 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
\n
public_scope_uid = portal.restrictedTraverse(\n
"portal_categories/allocation_scope/open/public", None).getUid()\n
friend_scope_uid = portal.restrictedTraverse(\n
"portal_categories/allocation_scope/open/friend", None).getUid()\n
\n
if public_scope_uid and friend_scope_uid:\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Computer\',\n
validation_state = \'validated\',\n
default_allocation_scope_uid=[public_scope_uid, friend_scope_uid],\n
method_id = \'Computer_checkAndCreateUpgradeDecision\',\n
activate_kw = {\'tag\':tag}\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_manageSoftwareCatalog.py
0 → 100644
View file @
4121077a
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Software Product'
,
validation_state
=
'published'
,
method_id
=
'SoftwareProduct_manageSoftwareCatalog'
,
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_manageSoftwareCatalog.xml
View file @
4121077a
...
...
@@ -48,19 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Software Product\',\n
validation_state=\'published\',\n
method_id=\'SoftwareProduct_manageSoftwareCatalog\',\n
activate_kw={\'tag\': tag}\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_processPlannedUpgradeDecision.py
0 → 100644
View file @
4121077a
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Upgrade Decision'
,
simulation_state
=
'planned'
,
method_id
=
'UpgradeDecision_notify'
,
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_processPlannedUpgradeDecision.xml
View file @
4121077a
...
...
@@ -48,19 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Upgrade Decision\',\n
simulation_state=\'planned\',\n
method_id=\'UpgradeDecision_notify\',\n
activate_kw={\'tag\': tag }\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_processStartedUpgradeDecision.py
0 → 100644
View file @
4121077a
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Upgrade Decision'
,
simulation_state
=
'started'
,
method_id
=
'UpgradeDecision_processUpgrade'
,
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_processStartedUpgradeDecision.xml
View file @
4121077a
...
...
@@ -48,19 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Upgrade Decision\',\n
simulation_state=\'started\',\n
method_id=\'UpgradeDecision_processUpgrade\',\n
activate_kw={\'tag\': tag }\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_processStoppedUpgradeDecision.py
0 → 100644
View file @
4121077a
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Upgrade Decision'
,
simulation_state
=
'stopped'
,
method_id
=
'UpgradeDecision_notifyDelivered'
,
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_processStoppedUpgradeDecision.xml
View file @
4121077a
...
...
@@ -48,19 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Upgrade Decision\',\n
simulation_state=\'stopped\',\n
method_id=\'UpgradeDecision_notifyDelivered\',\n
activate_kw={\'tag\': tag }\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Base_acceptUpgradeDecision.py
0 → 100644
View file @
4121077a
if
reference
is
None
:
raise
ValueError
(
"Missing Reference"
)
portal
=
context
.
getPortalObject
()
upgrade_decision_list
=
portal
.
portal_catalog
(
portal_type
=
"Upgrade Decision"
,
reference
=
reference
,
limit
=
2
)
if
not
len
(
upgrade_decision_list
):
return
context
.
Base_redirect
(
""
,
keep_items
=
{
"portal_status_message"
:
context
.
Base_translateString
(
"Unable to find the Upgrade Decision."
)})
if
len
(
upgrade_decision_list
)
>
1
:
raise
ValueError
(
"Duplicated reference for %s. Please contact site administrators."
%
reference
)
upgrade_decision
=
upgrade_decision_list
[
0
]
if
upgrade_decision
.
getSimulationState
()
in
[
'draft'
,
'planned'
]:
message
=
"Sorry, the upgrade is not possible yet!"
elif
upgrade_decision
.
getSimulationState
()
in
[
'cancelled'
,
'rejected'
]:
message
=
"Sorry, the upgrade is not possble, Upgrade Decision was Canceled or Rejected!"
elif
upgrade_decision
.
getSimulationState
()
==
'started'
:
message
=
"This Upgrade Decision is already Started."
elif
upgrade_decision
.
getSimulationState
()
in
[
'stopped'
,
'delivered'
]:
message
=
"This Upgrade Decision has been already processed."
elif
upgrade_decision
.
getSimulationState
()
==
'confirmed'
:
message
=
"This Upgrade Decision has been requested, it will be processed in few minutes."
upgrade_decision
.
start
()
return
context
.
Base_redirect
(
""
,
keep_items
=
{
"portal_status_message"
:
context
.
Base_translateString
(
message
)})
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Base_acceptUpgradeDecision.xml
View file @
4121077a
...
...
@@ -48,52 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
if reference is None:\n
raise ValueError("Missing Reference")\n
\n
portal = context.getPortalObject()\n
\n
upgrade_decision_list = portal.portal_catalog(\n
portal_type="Upgrade Decision", \n
reference=reference, limit=2)\n
\n
if not len(upgrade_decision_list):\n
return context.Base_redirect("", \n
keep_items={"portal_status_message": \n
context.Base_translateString("Unable to find the Upgrade Decision.")})\n
\n
if len(upgrade_decision_list) >
1:\n
raise ValueError("Duplicated reference for %s. Please contact site administrators." % reference)\n
\n
upgrade_decision = upgrade_decision_list[0]\n
\n
if upgrade_decision.getSimulationState() in [\'draft\', \'planned\']:\n
message = "Sorry, the upgrade is not possible yet!"\n
\n
elif upgrade_decision.getSimulationState() in [\'cancelled\', \'rejected\']:\n
message = "Sorry, the upgrade is not possble, Upgrade Decision was Canceled or Rejected!"\n
\n
elif upgrade_decision.getSimulationState() == \'started\':\n
message = "This Upgrade Decision is already Started."\n
\n
elif upgrade_decision.getSimulationState() in [\'stopped\', \'delivered\']:\n
message = "This Upgrade Decision has been already processed."\n
\n
elif upgrade_decision.getSimulationState() == \'confirmed\':\n
message = "This Upgrade Decision has been requested, it will be processed in few minutes."\n
upgrade_decision.start()\n
\n
return context.Base_redirect("", \n
keep_items={"portal_status_message": \n
context.Base_translateString(message)})\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
reference
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Base_rejectUpgradeDecision.py
0 → 100644
View file @
4121077a
if
reference
is
None
:
raise
ValueError
(
"Missing Reference"
)
portal
=
context
.
getPortalObject
()
upgrade_decision_list
=
portal
.
portal_catalog
(
portal_type
=
"Upgrade Decision"
,
reference
=
reference
,
limit
=
2
)
if
len
(
upgrade_decision_list
)
==
0
:
return
context
.
Base_redirect
(
""
,
keep_items
=
{
"portal_status_message"
:
context
.
Base_translateString
(
"Unable to find the Upgrade Decision."
)})
if
len
(
upgrade_decision_list
)
>
1
:
raise
ValueError
(
"Duplicated reference for %s. Please contact site administrators."
%
reference
)
upgrade_decision
=
upgrade_decision_list
[
0
]
if
upgrade_decision
.
getSimulationState
()
in
[
'cancelled'
,
'rejected'
]:
message
=
"Upgrade Decision is already Rejected!"
elif
upgrade_decision
.
getSimulationState
()
==
'started'
:
message
=
"Sorry, This Upgrade Decision is already Started, you cannot reject it anymore."
elif
upgrade_decision
.
getSimulationState
()
in
[
'stopped'
,
'delivered'
]:
message
=
"Sorry, this Upgrade Decision has been already processed."
elif
upgrade_decision
.
getSimulationState
()
in
[
'confirmed'
,
'draft'
,
'planned'
]:
message
=
"Thanks Upgrade Decision has been rejected Successfully (You cannot use it anymore)."
upgrade_decision
.
reject
()
return
context
.
Base_redirect
(
""
,
keep_items
=
{
"portal_status_message"
:
context
.
Base_translateString
(
message
)})
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Base_rejectUpgradeDecision.xml
View file @
4121077a
...
...
@@ -48,50 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
if reference is None:\n
raise ValueError("Missing Reference")\n
\n
portal = context.getPortalObject()\n
\n
upgrade_decision_list = portal.portal_catalog(\n
portal_type="Upgrade Decision", \n
reference=reference, limit=2)\n
\n
if len(upgrade_decision_list) == 0:\n
return context.Base_redirect("", \n
keep_items={"portal_status_message": \n
context.Base_translateString("Unable to find the Upgrade Decision.")})\n
\n
if len(upgrade_decision_list) >
1:\n
raise ValueError("Duplicated reference for %s. Please contact site administrators." % reference)\n
\n
upgrade_decision = upgrade_decision_list[0]\n
\n
\n
if upgrade_decision.getSimulationState() in [\'cancelled\', \'rejected\']:\n
message = "Upgrade Decision is already Rejected!"\n
\n
elif upgrade_decision.getSimulationState() == \'started\':\n
message = "Sorry, This Upgrade Decision is already Started, you cannot reject it anymore."\n
\n
elif upgrade_decision.getSimulationState() in [\'stopped\', \'delivered\']:\n
message = "Sorry, this Upgrade Decision has been already processed."\n
\n
elif upgrade_decision.getSimulationState() in [\'confirmed\', \'draft\', \'planned\']:\n
message = "Thanks Upgrade Decision has been rejected Successfully (You cannot use it anymore)."\n
upgrade_decision.reject()\n
\n
return context.Base_redirect("", \n
keep_items={"portal_status_message": \n
context.Base_translateString(message)})\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
reference
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Computer_checkAndCreateUpgradeDecision.py
0 → 100644
View file @
4121077a
from
DateTime
import
DateTime
computer
=
context
portal
=
context
.
getPortalObject
()
full_software_release_list
=
[
si
.
getUrlString
()
for
si
in
portal
.
portal_catalog
(
portal_type
=
'Software Installation'
,
default_aggregate_uid
=
computer
.
getUid
(),
validation_state
=
'validated'
)
if
si
.
getSlapState
()
==
'start_requested'
]
if
len
(
full_software_release_list
)
==
0
:
return
# group SR by Software Product to avoid two upgrade Decision for the same product
software_release_list
=
portal
.
portal_catalog
(
portal_type
=
'Software Release'
,
url_string
=
full_software_release_list
,
group_by
=
'default_aggregate_uid'
)
upgrade_decision_list
=
[]
for
software_release
in
software_release_list
:
software_product_reference
=
software_release
.
getAggregateReference
()
if
software_product_reference
in
[
None
,
""
]:
continue
sorted_list
=
portal
.
SoftwareProduct_getSortedSoftwareReleaseList
(
software_product_reference
=
software_product_reference
)
# Check if there is a new version of this software Product
if
sorted_list
and
\
sorted_list
[
0
].
getUrlString
()
not
in
full_software_release_list
:
newer_release
=
sorted_list
[
0
]
title
=
'A new version of %s is available for %s'
%
\
(
software_product_reference
,
context
.
getTitle
())
# If exist upgrade decision in progress try to cancel it
decision_in_progress
=
newer_release
.
\
SoftwareRelease_getUpgradeDecisionInProgress
(
computer
.
getUid
())
if
decision_in_progress
and
\
not
decision_in_progress
.
UpgradeDecision_tryToCancel
(
newer_release
.
getUrlString
()):
continue
upgrade_decision
=
newer_release
.
SoftwareRelease_createUpgradeDecision
(
source_url
=
computer
.
getRelativeUrl
(),
title
=
title
)
if
context
.
getAllocationScope
()
in
[
"open/public"
,
"open/friend"
]:
upgrade_decision
.
start
()
elif
context
.
getAllocationScope
()
in
[
"open/personal"
]:
upgrade_decision
.
plan
()
upgrade_decision
.
setStartDate
(
DateTime
())
upgrade_decision_list
.
append
(
upgrade_decision
)
return
upgrade_decision_list
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Computer_checkAndCreateUpgradeDecision.xml
View file @
4121077a
...
...
@@ -48,66 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from DateTime import DateTime\n
computer = context\n
portal = context.getPortalObject()\n
\n
full_software_release_list = [si.getUrlString() for si in\n
portal.portal_catalog(\n
portal_type=\'Software Installation\',\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\n
# group SR by Software Product to avoid two upgrade Decision for the same product\n
software_release_list = portal.portal_catalog(\n
portal_type=\'Software Release\',\n
url_string=full_software_release_list,\n
group_by=\'default_aggregate_uid\'\n
)\n
upgrade_decision_list = []\n
for software_release in software_release_list:\n
software_product_reference = software_release.getAggregateReference()\n
if software_product_reference in [None, ""]:\n
continue\n
\n
sorted_list = portal.SoftwareProduct_getSortedSoftwareReleaseList(\n
software_product_reference=software_product_reference)\n
\n
# Check if there is a new version of this software Product\n
if sorted_list and \\\n
sorted_list[0].getUrlString() not in full_software_release_list:\n
\n
newer_release = sorted_list[0]\n
title = \'A new version of %s is available for %s\' % \\\n
(software_product_reference, context.getTitle()) \n
# If exist upgrade decision in progress try to cancel it\n
decision_in_progress = newer_release.\\\n
SoftwareRelease_getUpgradeDecisionInProgress(computer.getUid())\n
if decision_in_progress and \\\n
not decision_in_progress.UpgradeDecision_tryToCancel(\n
newer_release.getUrlString()):\n
continue\n
\n
upgrade_decision = newer_release.SoftwareRelease_createUpgradeDecision(\n
source_url=computer.getRelativeUrl(),\n
title=title)\n
\n
if context.getAllocationScope() in ["open/public", "open/friend"]:\n
upgrade_decision.start()\n
elif context.getAllocationScope() in ["open/personal"]:\n
upgrade_decision.plan()\n
\n
upgrade_decision.setStartDate(DateTime())\n
upgrade_decision_list.append(upgrade_decision)\n
\n
return upgrade_decision_list\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Computer_hostingSubscriptionCreateUpgradeDecision.py
0 → 100644
View file @
4121077a
portal
=
context
.
getPortalObject
()
partition_list
=
portal
.
portal_catalog
(
portal_type
=
'Computer Partition'
,
free_for_request
=
0
,
parent_uid
=
context
.
getUid
())
valid_slap_state
=
[
'start_requested'
,
'stop_requested'
]
hosting_subscription_list
=
[]
upgrade_decision_list
=
[]
for
partition
in
partition_list
:
software_instance
=
partition
.
getAggregateRelatedValue
(
portal_type
=
'Software Instance'
)
if
not
software_instance
:
continue
hosting_subscription
=
software_instance
.
getSpecialiseValue
(
portal_type
=
'Hosting Subscription'
)
if
hosting_subscription
and
hosting_subscription
.
getSlapState
()
\
in
valid_slap_state
and
not
\
hosting_subscription
in
hosting_subscription_list
:
hosting_subscription_list
.
append
(
hosting_subscription
)
else
:
continue
newer_release
=
hosting_subscription
.
\
HostingSubscription_getUpgradableSoftwareRelease
()
if
newer_release
is
None
:
continue
decision_in_progress
=
newer_release
.
\
SoftwareRelease_getUpgradeDecisionInProgress
(
hosting_subscription
.
getUid
())
if
decision_in_progress
and
\
not
decision_in_progress
.
UpgradeDecision_tryToCancel
(
newer_release
.
getUrlString
()):
continue
upgrade_decision
=
newer_release
.
SoftwareRelease_createUpgradeDecision
(
source_url
=
hosting_subscription
.
getRelativeUrl
(),
title
=
'A new upgrade is available for %s'
%
hosting_subscription
.
getTitle
()
)
upgrade_decision
.
plan
()
upgrade_decision_list
.
append
(
upgrade_decision
)
return
upgrade_decision_list
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Computer_hostingSubscriptionCreateUpgradeDecision.xml
View file @
4121077a
...
...
@@ -48,55 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
\n
partition_list = portal.portal_catalog(portal_type=\'Computer Partition\',\n
free_for_request=0,\n
parent_uid=context.getUid())\n
valid_slap_state = [\'start_requested\', \'stop_requested\']\n
\n
hosting_subscription_list = []\n
upgrade_decision_list = []\n
for partition in partition_list:\n
software_instance = partition.getAggregateRelatedValue(\n
portal_type=\'Software Instance\')\n
if not software_instance:\n
continue\n
\n
hosting_subscription = software_instance.getSpecialiseValue(\n
portal_type=\'Hosting Subscription\')\n
if hosting_subscription and hosting_subscription.getSlapState() \\\n
in valid_slap_state and not \\\n
hosting_subscription in hosting_subscription_list:\n
hosting_subscription_list.append(hosting_subscription)\n
else:\n
continue\n
\n
newer_release = hosting_subscription.\\\n
HostingSubscription_getUpgradableSoftwareRelease()\n
if newer_release is None:\n
continue\n
\n
decision_in_progress = newer_release.\\\n
SoftwareRelease_getUpgradeDecisionInProgress(hosting_subscription.getUid())\n
\n
if decision_in_progress and \\\n
not decision_in_progress.UpgradeDecision_tryToCancel(\n
newer_release.getUrlString()):\n
continue\n
\n
upgrade_decision = newer_release.SoftwareRelease_createUpgradeDecision(\n
source_url=hosting_subscription.getRelativeUrl(),\n
title=\'A new upgrade is available for %s\' % hosting_subscription.getTitle()\n
)\n
upgrade_decision.plan()\n
upgrade_decision_list.append(upgrade_decision)\n
\n
return upgrade_decision_list\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/HostingSubscription_getNewerSofwareRelease.py
0 → 100644
View file @
4121077a
hosting_subscription
=
context
portal
=
context
.
getPortalObject
()
software_instance
=
hosting_subscription
.
getPredecessorValue
()
if
not
software_instance
:
return
None
software_release_list
=
context
.
SoftwareProduct_getSortedSoftwareReleaseList
(
software_release_url
=
software_instance
.
getUrlString
())
if
not
software_release_list
:
return
None
latest_software_release
=
software_release_list
[
0
]
if
latest_software_release
.
getUrlString
()
==
software_instance
.
getUrlString
():
return
None
else
:
return
latest_software_release
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/HostingSubscription_getNewerSofwareRelease.xml
View file @
4121077a
...
...
@@ -48,26 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
hosting_subscription = context\n
portal = context.getPortalObject()\n
\n
software_instance = hosting_subscription.getPredecessorValue()\n
if not software_instance:\n
return None\n
software_release_list = context.SoftwareProduct_getSortedSoftwareReleaseList(\n
software_release_url=software_instance.getUrlString())\n
\n
if not software_release_list:\n
return None\n
latest_software_release = software_release_list[0]\n
if latest_software_release.getUrlString() == software_instance.getUrlString():\n
return None\n
else:\n
return latest_software_release\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/HostingSubscription_getUpgradableSoftwareRelease.py
0 → 100644
View file @
4121077a
"""
Check if this hosting subscription is upgradable to the latest version,
and return the software release to upgrade with.
"""
hosting_subscription
=
context
portal
=
context
.
getPortalObject
()
slap_state
=
[
'start_requested'
,
'stop_requested'
]
if
not
hosting_subscription
.
getSlapState
()
in
slap_state
:
return
None
source_instance
=
hosting_subscription
.
getPredecessorValue
()
if
not
source_instance
or
source_instance
.
getSlapState
()
not
in
slap_state
:
return
None
software_release
=
hosting_subscription
.
HostingSubscription_getNewerSofwareRelease
()
if
not
software_release
:
return
None
computer
=
source_instance
.
getAggregateValue
().
getParentValue
()
if
computer
.
getValidationState
()
!=
'validated'
:
return
None
#Find Software Installation
software_installation_list
=
portal
.
portal_catalog
(
portal_type
=
"Software Installation"
,
validation_state
=
"validated"
,
url_string
=
software_release
.
getUrlString
(),
default_aggregate_uid
=
computer
.
getUid
(),
)
# check again slap_state because it might be ignored in previous request!
if
'start_requested'
in
[
software_installation
.
getSlapState
()
\
for
software_installation
in
software_installation_list
]:
return
software_release
return
None
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/HostingSubscription_getUpgradableSoftwareRelease.xml
View file @
4121077a
...
...
@@ -48,48 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""\n
Check if this hosting subscription is upgradable to the latest version,\n
and return the software release to upgrade with.\n
"""\n
\n
hosting_subscription = context\n
portal = context.getPortalObject()\n
\n
slap_state = [\'start_requested\', \'stop_requested\']\n
\n
if not hosting_subscription.getSlapState() in slap_state:\n
return None\n
\n
source_instance = hosting_subscription.getPredecessorValue()\n
if not source_instance or source_instance.getSlapState() not in slap_state:\n
return None\n
\n
software_release = hosting_subscription.HostingSubscription_getNewerSofwareRelease()\n
if not software_release:\n
return None\n
\n
computer = source_instance.getAggregateValue().getParentValue()\n
if computer.getValidationState() != \'validated\':\n
return None\n
\n
#Find Software Installation\n
software_installation_list = portal.portal_catalog(\n
portal_type="Software Installation",\n
validation_state="validated",\n
url_string=software_release.getUrlString(),\n
default_aggregate_uid=computer.getUid(),\n
)\n
# check again slap_state because it might be ignored in previous request!\n
if \'start_requested\' in [software_installation.getSlapState() \\\n
for software_installation in software_installation_list]:\n
return software_release\n
\n
return None\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
@@ -101,4 +59,4 @@ return None\n
</dictionary>
</pickle>
</record>
</ZopeData>
\ No newline at end of file
</ZopeData>
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/HostingSubscription_getUpgradeSubscriptionRelatedValue.py
0 → 100644
View file @
4121077a
"""
Get a related Upgrade Decision
"""
if
simulation_state
not
in
[
"confirmed"
,
"started"
,
"stopped"
]:
raise
ValueError
(
"You shouldn't request for this state: %s"
%
simulation_state
)
decision_line_list
=
context
.
getAggregateValueList
(
portal_type
=
"Upgrade Decision Line"
,
simulation_state
=
simulation_state
)
if
len
(
decision_line_list
)
>
1
:
raise
ValueError
(
"Your have more them one valid decison line!"
)
if
len
(
decision_line_list
)
==
0
:
return
None
return
decision_line_list
[
0
].
getParentValue
()
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/HostingSubscription_getUpgradeSubscriptionRelatedValue.xml
View file @
4121077a
...
...
@@ -48,33 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
"""\n
Get a related Upgrade Decision \n
"""\n
if simulation_state not in ["confirmed", "started", "stopped"]:\n
raise ValueError(\n
"You shouldn\'t request for this state: %s" % simulation_state)\n
\n
\n
decision_line_list = context.getAggregateValueList(\n
portal_type="Upgrade Decision Line", \n
simulation_state=simulation_state)\n
\n
if len(decision_line_list) >
1:\n
raise ValueError("Your have more them one valid decison line!")\n
\n
if len(decision_line_list) == 0:\n
return None\n
\n
return decision_line_list[0].getParentValue()\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
simulation_state=\'confirmed\'
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/SoftwareProduct_getSortedSoftwareReleaseList.py
0 → 100644
View file @
4121077a
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
if
software_release_url
is
None
and
\
context
.
getPortalType
()
==
"Software Product"
:
software_product_reference
=
context
.
getReference
()
if
software_product_reference
is
None
:
assert
(
software_release_url
is
not
None
)
software_release
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Software Release'
,
url_string
=
software_release_url
)
if
not
software_release
:
return
[]
software_product_reference
=
software_release
.
getAggregateReference
()
if
not
software_product_reference
:
return
[]
else
:
# Don't accept both parameters
assert
(
software_release_url
is
None
)
product_list
=
portal
.
portal_catalog
(
portal_type
=
'Software Product'
,
reference
=
software_product_reference
,
validation_state
=
'published'
,
limit
=
2
)
if
not
product_list
:
return
[]
if
len
(
product_list
)
>
1
:
raise
ValueError
(
'Several Software Product with the same reference.'
)
software_release_list
=
product_list
[
0
].
getAggregateRelatedValueList
()
def
sortkey
(
software_release
):
publication_date
=
software_release
.
getEffectiveDate
()
if
publication_date
:
if
(
publication_date
-
DateTime
())
>
0
:
return
DateTime
(
'1900/05/02'
)
return
publication_date
return
software_release
.
getCreationDate
()
software_release_list
=
sorted
(
software_release_list
,
key
=
sortkey
,
reverse
=
True
,
)
return
[
software_release
for
software_release
in
software_release_list
if
software_release
.
getValidationState
()
in
[
"published"
,
"published_alive"
]
]
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/SoftwareProduct_getSortedSoftwareReleaseList.xml
View file @
4121077a
...
...
@@ -48,70 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
from DateTime import DateTime\n
\n
portal = context.getPortalObject()\n
\n
if software_release_url is None and \\\n
context.getPortalType() == "Software Product":\n
software_product_reference = context.getReference()\n
\n
if software_product_reference is None:\n
assert(software_release_url is not None)\n
software_release = portal.portal_catalog.getResultValue(\n
portal_type=\'Software Release\',\n
url_string=software_release_url\n
)\n
if not software_release:\n
return []\n
\n
software_product_reference = software_release.getAggregateReference()\n
if not software_product_reference:\n
return []\n
\n
else:\n
# Don\'t accept both parameters\n
assert(software_release_url is None)\n
\n
product_list = portal.portal_catalog(\n
portal_type=\'Software Product\',\n
reference=software_product_reference,\n
validation_state=\'published\', \n
limit=2)\n
\n
if not product_list:\n
return []\n
\n
if len(product_list) >
1:\n
raise ValueError(\'Several Software Product with the same reference.\')\n
\n
software_release_list = product_list[0].getAggregateRelatedValueList()\n
\n
def sortkey(software_release):\n
publication_date = software_release.getEffectiveDate()\n
if publication_date:\n
if (publication_date - DateTime()) > 0:\n
return DateTime(\'1900/05/02\')\n
return publication_date\n
return software_release.getCreationDate()\n
\n
software_release_list = sorted(\n
software_release_list,\n
key=sortkey, reverse=True,\n
)\n
\n
return [software_release for software_release in software_release_list\n
if software_release.getValidationState() in\n
["published", "published_alive"]\n
]\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
software_product_reference=None, software_release_url=None
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/SoftwareProduct_manageSoftwareCatalog.py
0 → 100644
View file @
4121077a
portal
=
context
.
getPortalObject
()
software_release_url
=
None
for
software_release
in
portal
.
portal_catalog
(
portal_type
=
'Software Release'
,
validation_state
=
'published'
,
default_aggregate_uid
=
context
.
getUid
(),
sort_on
=
((
'indexation_timestamp'
,
'DESC'
),)):
installed_count
=
portal
.
portal_catalog
(
software_release_url
=
software_release
.
getUrlString
(),
allocation_scope_uid
=
portal
.
portal_categories
.
allocation_scope
.
open
.
public
.
getUid
(),
capacity_scope_uid
=
portal
.
portal_categories
.
capacity_scope
.
open
.
getUid
(),
portal_type
=
'Computer Partition'
,
free_for_request
=
1
,
limit
=
1
,
)
if
len
(
installed_count
)
>
0
:
software_release_url
=
software_release
.
getRelativeUrl
()
break
if
context
.
getAggregate
()
!=
software_release_url
:
context
.
setAggregate
(
software_release_url
)
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/SoftwareProduct_manageSoftwareCatalog.xml
View file @
4121077a
...
...
@@ -48,37 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
portal = context.getPortalObject()\n
\n
software_release_url = None\n
\n
for software_release in portal.portal_catalog(\n
portal_type=\'Software Release\',\n
validation_state=\'published\',\n
default_aggregate_uid=context.getUid(),\n
sort_on=((\'indexation_timestamp\', \'DESC\'),)):\n
installed_count = portal.portal_catalog(\n
software_release_url=software_release.getUrlString(),\n
allocation_scope_uid=portal.portal_categories.allocation_scope.open.public.getUid(),\n
capacity_scope_uid=portal.portal_categories.capacity_scope.open.getUid(),\n
portal_type=\'Computer Partition\',\n
free_for_request=1,\n
limit=1,\n
)\n
if len(installed_count) >
0:\n
software_release_url = software_release.getRelativeUrl()\n
break\n
\n
if context.getAggregate() != software_release_url:\n
context.setAggregate(software_release_url)\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/SoftwareRelease_createUpgradeDecision.py
0 → 100644
View file @
4121077a
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
software_release
=
context
source_product
=
portal
.
restrictedTraverse
(
source_url
,
None
)
if
not
source_product
:
return
portal_type
=
source_product
.
getPortalType
()
if
portal_type
==
'Computer'
:
person_url
=
source_product
.
getSourceAdministration
()
elif
portal_type
==
'Hosting Subscription'
:
person_url
=
source_product
.
getDestinationSection
()
else
:
return
if
not
person_url
:
return
upgrade_decision
=
portal
.
upgrade_decision_module
.
\
template_upgrade_decision
.
Base_createCloneDocument
(
batch_mode
=
1
)
upgrade_decision
.
edit
(
title
=
title
)
upgrade_decision
.
setDestinationSection
(
person_url
)
upgrade_decision
.
setDestinationDecision
(
person_url
)
decision_line_list
=
upgrade_decision
.
contentValues
(
portal_type
=
'Upgrade Decision Line'
)
if
len
(
decision_line_list
)
>
0
:
decision_line
=
decision_line_list
[
0
]
else
:
decision_line
=
upgrade_decision
.
newContent
(
portal_type
=
'Upgrade Decision Line'
)
decision_line
.
edit
(
title
=
'Request decision upgrade for %s on %s %s'
%
(
software_release
.
getTitle
(),
portal_type
,
source_product
.
getReference
()),
aggregate
=
[
source_url
,
software_release
.
getRelativeUrl
()])
return
upgrade_decision
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/SoftwareRelease_createUpgradeDecision.xml
View file @
4121077a
...
...
@@ -48,56 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
from DateTime import DateTime\n
\n
portal = context.getPortalObject()\n
software_release = context\n
\n
source_product = portal.restrictedTraverse(source_url, None)\n
if not source_product:\n
return\n
\n
portal_type = source_product.getPortalType()\n
if portal_type == \'Computer\':\n
person_url = source_product.getSourceAdministration()\n
elif portal_type == \'Hosting Subscription\':\n
person_url = source_product.getDestinationSection()\n
else:\n
return\n
\n
if not person_url:\n
return\n
\n
upgrade_decision = portal.upgrade_decision_module.\\\n
template_upgrade_decision.Base_createCloneDocument(batch_mode=1)\n
\n
upgrade_decision.edit(title=title)\n
\n
upgrade_decision.setDestinationSection(person_url)\n
upgrade_decision.setDestinationDecision(person_url)\n
\n
decision_line_list = upgrade_decision.contentValues(\n
portal_type=\'Upgrade Decision Line\')\n
if len(decision_line_list) >
0:\n
decision_line = decision_line_list[0]\n
else:\n
decision_line = upgrade_decision.newContent(\n
portal_type=\'Upgrade Decision Line\')\n
\n
decision_line.edit(\n
title=\'Request decision upgrade for %s on %s %s\' % (\n
software_release.getTitle(), portal_type, source_product.getReference()),\n
aggregate=[source_url, software_release.getRelativeUrl()])\n
\n
return upgrade_decision\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
source_url, title
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/SoftwareRelease_getUpgradeDecisionInProgress.py
0 → 100644
View file @
4121077a
portal
=
context
.
getPortalObject
()
product_reference
=
context
.
getAggregateReference
()
decision_line_in_progress_list
=
portal
.
portal_catalog
(
portal_type
=
'Upgrade Decision Line'
,
default_aggregate_uid
=
aggregate_uid
)
for
decision_line
in
decision_line_in_progress_list
:
upgrade_decision
=
decision_line
.
getParentValue
()
simulation_state
=
upgrade_decision
.
getSimulationState
()
if
simulation_state
not
in
[
'planned'
,
'confirmed'
,
'started'
,
'stopped'
,
'rejected'
]:
continue
release_list
=
decision_line
.
getAggregateValueList
(
portal_type
=
"Software Release"
)
if
len
(
release_list
)
>
1
:
continue
if
not
release_list
[
0
]:
continue
# If the current sr in rejected we must prevent creation of new upgrade decision for this sr
if
simulation_state
==
'rejected'
and
\
release_list
[
0
].
getUrlString
()
!=
context
.
getUrlString
():
continue
# If both software release belong to the same software product, there is an upgrade decision in progress
if
product_reference
==
release_list
[
0
].
getAggregateReference
():
return
upgrade_decision
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/SoftwareRelease_getUpgradeDecisionInProgress.xml
View file @
4121077a
...
...
@@ -48,40 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
portal = context.getPortalObject()\n
product_reference = context.getAggregateReference()\n
\n
decision_line_in_progress_list = portal.portal_catalog(\n
portal_type=\'Upgrade Decision Line\',\n
default_aggregate_uid=aggregate_uid)\n
\n
for decision_line in decision_line_in_progress_list:\n
upgrade_decision = decision_line.getParentValue()\n
simulation_state = upgrade_decision.getSimulationState()\n
if simulation_state not in [\'planned\', \'confirmed\',\n
\'started\', \'stopped\', \'rejected\']:\n
continue\n
release_list = decision_line.getAggregateValueList(portal_type="Software Release")\n
if len(release_list) >
1:\n
continue\n
if not release_list[0]:\n
continue\n
# If the current sr in rejected we must prevent creation of new upgrade decision for this sr\n
if simulation_state == \'rejected\' and \\\n
release_list[0].getUrlString() != context.getUrlString():\n
continue\n
\n
# If both software release belong to the same software product, there is an upgrade decision in progress \n
if product_reference == release_list[0].getAggregateReference():\n
return upgrade_decision\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
aggregate_uid
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecisionLine_cancelDestroyed.py
0 → 100644
View file @
4121077a
software_instance
=
context
.
getAggregateValue
(
portal_type
=
"Hosting Subscription"
)
if
software_instance
is
not
None
and
software_instance
.
getSlapState
()
==
"destroy_requested"
:
context
.
getParentValue
().
cancel
()
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecisionLine_cancelDestroyed.xml
View file @
4121077a
...
...
@@ -48,13 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
software_instance = context.getAggregateValue(portal_type="Hosting Subscription")\n
if software_instance is not None and software_instance.getSlapState() == "destroy_requested":\n
context.getParentValue().cancel()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_afterClone.py
0 → 100644
View file @
4121077a
context
.
UpgradeDecision_init
()
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_afterClone.xml
View file @
4121077a
...
...
@@ -48,11 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
context.UpgradeDecision_init()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getComputer.py
0 → 100644
View file @
4121077a
computer_list
=
[]
for
decision_line
in
context
.
contentValues
():
computer_list
.
extend
(
decision_line
.
getAggregateValueList
(
portal_type
=
"Computer"
))
if
len
(
computer_list
)
>
1
:
raise
ValueError
(
"It is only allowed to have more them 1 Computer"
)
if
len
(
computer_list
)
==
0
:
return
None
return
computer_list
[
0
]
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getComputer.xml
View file @
4121077a
...
...
@@ -48,27 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
computer_list = []\n
for decision_line in context.contentValues():\n
computer_list.extend(\n
decision_line.getAggregateValueList(portal_type="Computer"))\n
\n
if len(computer_list) >
1: \n
raise ValueError("It is only allowed to have more them 1 Computer")\n
\n
if len(computer_list) == 0:\n
return None\n
\n
\n
return computer_list[0]\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getComputerNotificationMessage.py
0 → 100644
View file @
4121077a
portal
=
context
.
getPortalObject
()
notification_message
=
portal
.
portal_notifications
.
getDocumentValue
(
reference
=
'slapos-upgrade-computer.notification'
)
title
=
"New Software available for Installation at %s"
%
computer
.
getTitle
()
mapping_dict
=
{
'software_product_title'
:
software_product_title
,
'computer_title'
:
computer
.
getTitle
(),
'computer_reference'
:
computer
.
getReference
(),
'software_release_name'
:
software_release
.
getTitle
(),
'software_release_reference'
:
software_release
.
getReference
(),
'upgrade_accept_link'
:
'Base_acceptUpgradeDecision?reference=%s'
%
reference
,
'upgrade_reject_link'
:
'Base_rejectUpgradeDecision?reference=%s'
%
reference
,
'new_software_release_url'
:
software_release
.
getUrlString
(),
}
if
notification_message
is
not
None
:
message
=
notification_message
.
asEntireHTML
(
substitution_method_parameter_dict
=
{
'mapping_dict'
:
mapping_dict
})
else
:
raise
ValueError
(
"No Notification Message"
)
return
title
,
message
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getComputerNotificationMessage.xml
View file @
4121077a
...
...
@@ -48,36 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
\n
notification_message = portal.portal_notifications.getDocumentValue(\n
reference=\'slapos-upgrade-computer.notification\')\n
\n
title = "New Software available for Installation at %s" % computer.getTitle()\n
mapping_dict = {\'software_product_title\': software_product_title,\n
\'computer_title\': computer.getTitle(),\n
\'computer_reference\': computer.getReference(),\n
\'software_release_name\': software_release.getTitle(),\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
\n
return title, message\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
computer
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getHostingSubscription.py
0 → 100644
View file @
4121077a
hosting_subscription_list
=
[]
for
decision_line
in
context
.
contentValues
():
hosting_subscription_list
.
extend
(
decision_line
.
getAggregateValueList
(
portal_type
=
"Hosting Subscription"
))
if
len
(
hosting_subscription_list
)
>
1
:
raise
ValueError
(
"It is only allowed to have more them 1 Hosting Subscription"
)
if
len
(
hosting_subscription_list
)
==
0
:
return
None
return
hosting_subscription_list
[
0
]
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getHostingSubscription.xml
View file @
4121077a
...
...
@@ -48,27 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
hosting_subscription_list = []\n
for decision_line in context.contentValues():\n
hosting_subscription_list.extend(\n
decision_line.getAggregateValueList(portal_type="Hosting Subscription"))\n
\n
if len(hosting_subscription_list) >
1: \n
raise ValueError("It is only allowed to have more them 1 Hosting Subscription")\n
\n
if len(hosting_subscription_list) == 0:\n
return None\n
\n
\n
return hosting_subscription_list[0]\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getResourceItemList.py
0 → 100644
View file @
4121077a
return
context
.
Ticket_getResourceItemList
()
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getResourceItemList.xml
View file @
4121077a
...
...
@@ -48,11 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
return context.Ticket_getResourceItemList()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getSoftwareRelease.py
0 → 100644
View file @
4121077a
software_release_list
=
[]
for
decision_line
in
context
.
contentValues
():
software_release_list
.
extend
(
decision_line
.
getAggregateValueList
(
portal_type
=
"Software Release"
))
if
len
(
software_release_list
)
>
1
:
raise
ValueError
(
"It is only allowed to have more them 1 Software Release"
)
if
len
(
software_release_list
)
==
0
:
return
None
return
software_release_list
[
0
]
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getSoftwareRelease.xml
View file @
4121077a
...
...
@@ -48,27 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
software_release_list = []\n
for decision_line in context.contentValues():\n
software_release_list.extend(\n
decision_line.getAggregateValueList(portal_type="Software Release"))\n
\n
if len(software_release_list) >
1: \n
raise ValueError("It is only allowed to have more them 1 Software Release")\n
\n
if len(software_release_list) == 0:\n
return None\n
\n
\n
return software_release_list[0]\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_init.py
0 → 100644
View file @
4121077a
# Define Reference from ID provided by portal_ids
portal
=
context
.
getPortalObject
()
type_definition
=
context
.
getTypeInfo
()
short_portal_type
=
type_definition
.
getShortTitle
()
if
not
short_portal_type
:
short_portal_type
=
''
.
join
(
s
for
s
in
type_definition
.
getId
()
if
s
.
isupper
())
id_group
=
(
'reference'
,
short_portal_type
)
default
=
1
new_id
=
portal
.
portal_ids
.
generateNewId
(
id_group
=
id_group
,
default
=
default
)
reference
=
'%s-%s'
%
(
short_portal_type
,
new_id
)
context
.
setReference
(
reference
)
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_init.xml
View file @
4121077a
...
...
@@ -48,24 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
# Define Reference from ID provided by portal_ids\n
portal = context.getPortalObject()\n
type_definition = context.getTypeInfo()\n
\n
short_portal_type = type_definition.getShortTitle()\n
if not short_portal_type:\n
short_portal_type = \'\'.join(s for s in type_definition.getId() if s.isupper())\n
\n
id_group = (\'reference\', short_portal_type)\n
default = 1\n
new_id = portal.portal_ids.generateNewId(id_group=id_group, default=default)\n
reference = \'%s-%s\' % (short_portal_type, new_id)\n
\n
context.setReference(reference)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_isUpgradeFinished.py
0 → 100644
View file @
4121077a
portal
=
context
.
getPortalObject
()
hosting_subscription
=
context
.
UpgradeDecision_getHostingSubscription
()
computer
=
context
.
UpgradeDecision_getComputer
()
software_release
=
context
.
UpgradeDecision_getSoftwareRelease
()
if
hosting_subscription
is
not
None
:
if
hosting_subscription
.
getUrlString
()
==
software_release
.
getUrlString
():
return
True
elif
computer
is
not
None
:
full_software_release_list
=
[
si
for
si
in
portal
.
portal_catalog
(
portal_type
=
'Software Installation'
,
url_string
=
software_release
.
getUrlString
(),
default_aggregate_uid
=
computer
.
getUid
(),
validation_state
=
'validated'
)
if
si
.
getSlapState
()
==
'start_requested'
]
if
len
(
full_software_release_list
)
>
0
:
return
True
return
False
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_isUpgradeFinished.xml
View file @
4121077a
...
...
@@ -48,37 +48,6 @@
</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>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notify.py
0 → 100644
View file @
4121077a
from
DateTime
import
DateTime
if
context
.
getSimulationState
()
!=
'planned'
:
# XXX Don't notify the ones which are not planned.
return
portal
=
context
.
getPortalObject
()
person
=
context
.
getDestinationDecisionValue
(
portal_type
=
"Person"
)
if
not
person
:
raise
ValueError
(
"Inconsistent Upgrade Decision, No Destination Decision"
)
hosting_subscription
=
context
.
UpgradeDecision_getHostingSubscription
()
computer
=
context
.
UpgradeDecision_getComputer
()
software_release
=
context
.
UpgradeDecision_getSoftwareRelease
()
software_product_title
=
software_release
.
getAggregateTitle
(
portal_type
=
"Software Product"
)
reference
=
context
.
getReference
()
mapping_dict
=
{
'software_product_title'
:
software_product_title
,
'upgrade_accept_link'
:
'Base_acceptUpgradeDecision?reference=%s'
%
reference
,
'upgrade_reject_link'
:
'Base_rejectUpgradeDecision?reference=%s'
%
reference
,
'software_release_name'
:
software_release
.
getTitle
(),
'software_release_reference'
:
software_release
.
getReference
(),
'new_software_release_url'
:
software_release
.
getUrlString
(),
}
if
hosting_subscription
is
not
None
:
notification_message_reference
=
'slapos-upgrade-hosting-subscription.notification'
title
=
"New Upgrade available for %s"
%
hosting_subscription
.
getTitle
()
mapping_dict
.
update
(
**
{
'hosting_subscription_title'
:
hosting_subscription
.
getTitle
(),
'old_software_release_url'
:
hosting_subscription
.
getUrlString
()})
elif
computer
is
not
None
:
notification_message_reference
=
'slapos-upgrade-computer.notification'
title
=
"New Software available for Installation at %s"
%
computer
.
getTitle
()
mapping_dict
.
update
(
**
{
'computer_title'
:
computer
.
getTitle
(),
'computer_reference'
:
computer
.
getReference
()})
if
notification_message_reference
is
None
:
raise
ValueError
(
"No Notification Message"
)
notification_message
=
portal
.
portal_notifications
.
getDocumentValue
(
reference
=
notification_message_reference
)
message
=
notification_message
.
asEntireHTML
(
substitution_method_parameter_dict
=
{
'mapping_dict'
:
mapping_dict
})
event
=
context
.
SupportRequest_trySendNotificationMessage
(
title
,
message
,
person
.
getRelativeUrl
())
if
event
is
not
None
:
context
.
confirm
()
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notify.xml
View file @
4121077a
...
...
@@ -48,69 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from DateTime import DateTime\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
\n
person = context.getDestinationDecisionValue(portal_type="Person")\n
if not person:\n
raise ValueError("Inconsistent Upgrade Decision, No Destination Decision")\n
\n
hosting_subscription = context.UpgradeDecision_getHostingSubscription()\n
computer = context.UpgradeDecision_getComputer()\n
software_release = context.UpgradeDecision_getSoftwareRelease()\n
software_product_title = software_release.getAggregateTitle(\n
portal_type="Software Product")\n
reference = context.getReference()\n
\n
mapping_dict = {\n
\'software_product_title\': software_product_title,\n
\'upgrade_accept_link\': \'Base_acceptUpgradeDecision?reference=%s\' % reference,\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
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
mapping_dict.update(**{\n
\'hosting_subscription_title\': hosting_subscription.getTitle(),\n
\'old_software_release_url\': hosting_subscription.getUrlString()})\n
\n
\n
elif computer is not None:\n
\n
notification_message_reference = \'slapos-upgrade-computer.notification\' \n
\n
title = "New Software available for Installation at %s" % computer.getTitle()\n
mapping_dict.update(**{\'computer_title\': computer.getTitle(),\n
\'computer_reference\': computer.getReference()})\n
\n
\n
if notification_message_reference is None:\n
raise ValueError("No Notification Message")\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
message, person.getRelativeUrl())\n
\n
if event is not None:\n
context.confirm()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notifyDelivered.py
0 → 100644
View file @
4121077a
from
DateTime
import
DateTime
if
context
.
getSimulationState
()
!=
'stopped'
:
return
if
not
context
.
UpgradeDecision_isUpgradeFinished
():
return
portal
=
context
.
getPortalObject
()
person
=
context
.
getDestinationDecisionValue
(
portal_type
=
"Person"
)
if
not
person
:
raise
ValueError
(
"Inconsistent Upgrade Decision, No Destination Decision"
)
hosting_subscription
=
context
.
UpgradeDecision_getHostingSubscription
()
computer
=
context
.
UpgradeDecision_getComputer
()
software_release
=
context
.
UpgradeDecision_getSoftwareRelease
()
software_product_title
=
software_release
.
getAggregateTitle
(
portal_type
=
"Software Product"
)
reference
=
context
.
getReference
()
mapping_dict
=
{
'software_product_title'
:
software_product_title
,
'software_release_name'
:
software_release
.
getTitle
(),
'software_release_reference'
:
software_release
.
getReference
(),
'new_software_release_url'
:
software_release
.
getUrlString
(),
}
if
hosting_subscription
is
not
None
:
notification_message_reference
=
'slapos-upgrade-delivered-hosting-subscription.notification'
title
=
"Upgrade Processed for %s (%s)"
%
(
hosting_subscription
.
getTitle
(),
software_release
.
getReference
())
mapping_dict
.
update
(
**
{
'hosting_subscription_title'
:
hosting_subscription
.
getTitle
(),
'old_software_release_url'
:
hosting_subscription
.
getUrlString
()})
elif
computer
is
not
None
:
notification_message_reference
=
'slapos-upgrade-delivered-computer.notification'
title
=
"Upgrade processed at %s for %s"
%
(
computer
.
getTitle
(),
software_release
.
getReference
())
mapping_dict
.
update
(
**
{
'computer_title'
:
computer
.
getTitle
(),
'computer_reference'
:
computer
.
getReference
()})
if
notification_message_reference
is
None
:
raise
ValueError
(
"No Notification Message"
)
notification_message
=
portal
.
portal_notifications
.
getDocumentValue
(
reference
=
notification_message_reference
)
message
=
notification_message
.
asEntireHTML
(
substitution_method_parameter_dict
=
{
'mapping_dict'
:
mapping_dict
})
event
=
context
.
SupportRequest_trySendNotificationMessage
(
title
,
message
,
person
.
getRelativeUrl
())
if
event
is
not
None
:
context
.
setStopDate
(
DateTime
())
context
.
deliver
()
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notifyDelivered.xml
View file @
4121077a
...
...
@@ -48,71 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from DateTime import DateTime\n
\n
if context.getSimulationState() != \'stopped\':\n
return \n
\n
if not context.UpgradeDecision_isUpgradeFinished():\n
return \n
\n
portal = context.getPortalObject()\n
\n
person = context.getDestinationDecisionValue(portal_type="Person")\n
if not person:\n
raise ValueError("Inconsistent Upgrade Decision, No Destination Decision")\n
\n
hosting_subscription = context.UpgradeDecision_getHostingSubscription()\n
computer = context.UpgradeDecision_getComputer()\n
software_release = context.UpgradeDecision_getSoftwareRelease()\n
software_product_title = software_release.getAggregateTitle(\n
portal_type="Software Product")\n
\n
reference = context.getReference()\n
\n
mapping_dict = {\n
\'software_product_title\': software_product_title,\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
if hosting_subscription is not None:\n
notification_message_reference = \'slapos-upgrade-delivered-hosting-subscription.notification\'\n
title = "Upgrade Processed for %s (%s)" % (hosting_subscription.getTitle(), \n
software_release.getReference())\n
mapping_dict.update(**{\n
\'hosting_subscription_title\': hosting_subscription.getTitle(),\n
\'old_software_release_url\': hosting_subscription.getUrlString()})\n
\n
elif computer is not None:\n
\n
notification_message_reference = \'slapos-upgrade-delivered-computer.notification\' \n
\n
title = "Upgrade processed at %s for %s" % (computer.getTitle(), software_release.getReference()) \n
mapping_dict.update(**{\'computer_title\': computer.getTitle(),\n
\'computer_reference\': computer.getReference()})\n
\n
\n
if notification_message_reference is None:\n
raise ValueError("No Notification Message")\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
message, person.getRelativeUrl())\n
\n
if event is not None:\n
context.setStopDate(DateTime())\n
context.deliver()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_processUpgrade.py
0 → 100644
View file @
4121077a
if
context
.
UpgradeDecision_upgradeHostingSubscription
():
return
True
if
context
.
UpgradeDecision_upgradeComputer
():
return
True
return
False
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_processUpgrade.xml
View file @
4121077a
...
...
@@ -48,17 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
if context.UpgradeDecision_upgradeHostingSubscription():\n
return True\n
\n
if context.UpgradeDecision_upgradeComputer():\n
return True\n
\n
return False\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_tryToCancel.py
0 → 100644
View file @
4121077a
upgrade_decision
=
context
cancellable_state_list
=
[
'confirmed'
,
'planned'
]
require_state_list
=
[
'rejected'
,
'confirmed'
,
'planned'
]
simulation_state
=
upgrade_decision
.
getSimulationState
()
if
simulation_state
in
require_state_list
:
current_release
=
upgrade_decision
.
UpgradeDecision_getSoftwareRelease
()
if
not
current_release
:
# This upgrade decision is not valid
return
False
if
current_release
.
getUrlString
()
==
new_url_string
:
# Cannot cancel because the software releases are the same
return
False
if
simulation_state
in
cancellable_state_list
:
upgrade_decision
.
cancel
()
return
True
else
:
return
False
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_tryToCancel.xml
View file @
4121077a
...
...
@@ -48,28 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
upgrade_decision = context\n
cancellable_state_list = [\'confirmed\', \'planned\']\n
require_state_list = [\'rejected\', \'confirmed\', \'planned\']\n
simulation_state = upgrade_decision.getSimulationState()\n
\n
if simulation_state in require_state_list:\n
current_release = upgrade_decision.UpgradeDecision_getSoftwareRelease()\n
if not current_release:\n
# This upgrade decision is not valid\n
return False\n
if current_release.getUrlString() == new_url_string:\n
# Cannot cancel because the software releases are the same\n
return False\n
if simulation_state in cancellable_state_list:\n
upgrade_decision.cancel()\n
return True\n
else:\n
return False\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
new_url_string
</string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_upgradeComputer.py
0 → 100644
View file @
4121077a
if
context
.
getSimulationState
()
!=
'started'
:
# Update Decision is not on started state, Upgrade is not possible!
return
False
computer
=
context
.
UpgradeDecision_getComputer
()
software_release
=
context
.
UpgradeDecision_getSoftwareRelease
()
if
computer
is
None
:
return
False
if
software_release
is
None
:
return
False
software_release_url
=
software_release
.
getUrlString
()
computer
.
requestSoftwareRelease
(
software_release_url
=
software_release_url
,
state
=
"available"
)
context
.
stop
()
return
True
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_upgradeComputer.xml
View file @
4121077a
...
...
@@ -48,32 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
if context.getSimulationState() != \'started\':\n
# Update Decision is not on started state, Upgrade is not possible!\n
return False\n
\n
computer = context.UpgradeDecision_getComputer()\n
software_release = context.UpgradeDecision_getSoftwareRelease()\n
\n
if computer is None:\n
return False\n
\n
if software_release is None:\n
return False \n
\n
software_release_url = software_release.getUrlString()\n
\n
computer.requestSoftwareRelease(\n
software_release_url=software_release_url,\n
state="available")\n
\n
context.stop()\n
\n
return True\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_upgradeHostingSubscription.py
0 → 100644
View file @
4121077a
if
context
.
getSimulationState
()
!=
'started'
:
# Update Decision is not on started state, Upgrade is not possible!
return
False
hosting_subscription
=
context
.
UpgradeDecision_getHostingSubscription
()
software_release
=
context
.
UpgradeDecision_getSoftwareRelease
()
if
hosting_subscription
is
None
:
return
False
if
software_release
is
None
:
return
False
software_release_url
=
software_release
.
getUrlString
()
person
=
hosting_subscription
.
getDestinationSectionValue
(
portal_type
=
"Person"
)
status
=
hosting_subscription
.
getSlapState
()
if
status
==
"start_requested"
:
state
=
"started"
elif
status
==
"stop_requested"
:
state
=
"stopped"
elif
status
==
"destroy_requested"
:
state
=
"destroyed"
person
.
requestSoftwareInstance
(
state
=
state
,
software_release
=
software_release_url
,
software_title
=
hosting_subscription
.
getTitle
(),
software_type
=
hosting_subscription
.
getSourceReference
(),
instance_xml
=
hosting_subscription
.
getTextContent
(),
sla_xml
=
hosting_subscription
.
getSlaXml
(),
shared
=
hosting_subscription
.
isRootSlave
()
)
context
.
stop
()
return
True
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_upgradeHostingSubscription.xml
View file @
4121077a
...
...
@@ -48,49 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
if context.getSimulationState() != \'started\':\n
# Update Decision is not on started state, Upgrade is not possible!\n
return False\n
\n
hosting_subscription = context.UpgradeDecision_getHostingSubscription()\n
software_release = context.UpgradeDecision_getSoftwareRelease()\n
\n
if hosting_subscription is None:\n
return False\n
\n
if software_release is None:\n
return False \n
\n
software_release_url = software_release.getUrlString()\n
\n
person = hosting_subscription.getDestinationSectionValue(portal_type="Person")\n
\n
status = hosting_subscription.getSlapState()\n
\n
if status == "start_requested":\n
state = "started"\n
elif status == "stop_requested":\n
state = "stopped"\n
elif status == "destroy_requested":\n
state = "destroyed"\n
\n
person.requestSoftwareInstance(\n
state=state,\n
software_release=software_release_url,\n
software_title=hosting_subscription.getTitle(),\n
software_type=hosting_subscription.getSourceReference(),\n
instance_xml=hosting_subscription.getTextContent(),\n
sla_xml=hosting_subscription.getSlaXml(),\n
shared=hosting_subscription.isRootSlave()\n
)\n
\n
context.stop()\n
\n
return True\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_pdm/bt/template_path_list
View file @
4121077a
portal_alarms/slapos_manage_software_catalog
portal_alarms/slapos_pdm_computer_create_upgrade_decision
portal_alarms/slapos_pdm_hosting_subscription_auto_cancel_upgrade_decision
portal_alarms/slapos_pdm_hosting_subscription_create_upgrade_decision
portal_alarms/slapos_pdm_upgrade_decision_process_planned
portal_alarms/slapos_pdm_upgrade_decision_process_started
...
...
master/bt5/slapos_pdm/bt/template_test_id_list
View file @
4121077a
test.erp5.testSlapOSPDMAlarm
test.erp5.testSlapOSPDMSkins
test.erp5.testSlapOSPDMSkins
\ 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