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
Klaus Wölfel
slapos.core
Commits
a7d9cd78
Commit
a7d9cd78
authored
Aug 01, 2014
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_pdm: Rename alarms and update test
parent
dee043af
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
77 deletions
+43
-77
master/bt5/slapos_pdm/PathTemplateItem/portal_alarms/slapos_pdm_hosting_subscription_create_upgrade_decision.xml
...apos_pdm_hosting_subscription_create_upgrade_decision.xml
+1
-1
master/bt5/slapos_pdm/PathTemplateItem/portal_alarms/slapos_pdm_upgrade_decision_process_planned.xml
...al_alarms/slapos_pdm_upgrade_decision_process_planned.xml
+1
-1
master/bt5/slapos_pdm/PathTemplateItem/portal_alarms/slapos_pdm_upgrade_decision_process_started.xml
...al_alarms/slapos_pdm_upgrade_decision_process_started.xml
+1
-1
master/bt5/slapos_pdm/TestTemplateItem/testSlapOSPDMAlarm.py
master/bt5/slapos_pdm/TestTemplateItem/testSlapOSPDMAlarm.py
+36
-70
master/bt5/slapos_pdm/bt/revision
master/bt5/slapos_pdm/bt/revision
+1
-1
master/bt5/slapos_pdm/bt/template_path_list
master/bt5/slapos_pdm/bt/template_path_list
+3
-3
No files found.
master/bt5/slapos_pdm/PathTemplateItem/portal_alarms/slapos_hosting_subscription_create_upgrade_decision.xml
→
master/bt5/slapos_pdm/PathTemplateItem/portal_alarms/slapos_
pdm_
hosting_subscription_create_upgrade_decision.xml
View file @
a7d9cd78
...
...
@@ -20,7 +20,7 @@
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
slapos_hosting_subscription_create_upgrade_decision
</string>
</value>
<value>
<string>
slapos_
pdm_
hosting_subscription_create_upgrade_decision
</string>
</value>
</item>
<item>
<key>
<string>
periodicity_day_frequency
</string>
</key>
...
...
master/bt5/slapos_pdm/PathTemplateItem/portal_alarms/slapos_upgrade_decision_process_planned.xml
→
master/bt5/slapos_pdm/PathTemplateItem/portal_alarms/slapos_
pdm_
upgrade_decision_process_planned.xml
View file @
a7d9cd78
...
...
@@ -22,7 +22,7 @@
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
slapos_upgrade_decision_process_planned
</string>
</value>
<value>
<string>
slapos_
pdm_
upgrade_decision_process_planned
</string>
</value>
</item>
<item>
<key>
<string>
periodicity_day_frequency
</string>
</key>
...
...
master/bt5/slapos_pdm/PathTemplateItem/portal_alarms/slapos_upgrade_decision_process_started.xml
→
master/bt5/slapos_pdm/PathTemplateItem/portal_alarms/slapos_
pdm_
upgrade_decision_process_started.xml
View file @
a7d9cd78
...
...
@@ -22,7 +22,7 @@
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
slapos_upgrade_decision_process_started
</string>
</value>
<value>
<string>
slapos_
pdm_
upgrade_decision_process_started
</string>
</value>
</item>
<item>
<key>
<string>
periodicity_day_frequency
</string>
</key>
...
...
master/bt5/slapos_pdm/TestTemplateItem/testSlapOSPDMAlarm.py
View file @
a7d9cd78
...
...
@@ -13,12 +13,13 @@ class TestSlapOSUpgradeDecisionProcess(testSlapOSMixin):
return
"%sTEST"
%
self
.
portal
.
portal_ids
.
generateNewId
(
id_group
=
(
'slapos_core_test'
))
def
_makeUpgradeDecision
(
self
):
def
_makeUpgradeDecision
(
self
,
confirm
=
True
):
upgrade_decision
=
self
.
portal
.
\
upgrade_decision_module
.
newContent
(
portal_type
=
"Upgrade Decision"
,
title
=
"TESTUPDE-%s"
%
self
.
new_id
)
upgrade_decision
.
confirm
()
if
confirm
:
upgrade_decision
.
confirm
()
return
upgrade_decision
def
_makeComputer
(
self
,
new_id
):
...
...
@@ -35,14 +36,8 @@ class TestSlapOSUpgradeDecisionProcess(testSlapOSMixin):
computer
.
validate
()
return
computer
def
_simulateUpgradeDecision_upgradeHostingSubscription
(
self
,
fake_return
=
"True"
):
self
.
_simulateScript
(
'UpgradeDecision_upgradeHostingSubscription'
,
fake_return
)
def
_simulateUpgradeDecision_upgradeComputer
(
self
,
fake_return
=
"True"
):
self
.
_simulateScript
(
'UpgradeDecision_upgradeComputer'
,
fake_return
)
def
_simulateScript
(
self
,
script_name
,
fake_return
):
def
_simulateScript
(
self
,
script_name
,
fake_return
=
'True'
):
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
...
...
@@ -55,11 +50,6 @@ return %s
"""
%
(
script_name
,
fake_return
))
transaction
.
commit
()
def
_dropUpgradeDecision_upgradeHostingSubscription
(
self
):
self
.
_dropScript
(
'UpgradeDecision_upgradeHostingSubscription'
)
def
_dropUpgradeDecision_upgradeComputer
(
self
):
self
.
_dropScript
(
'UpgradeDecision_upgradeComputer'
)
def
_dropScript
(
self
,
script_name
):
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
...
...
@@ -71,12 +61,12 @@ return %s
upgrade_decision
.
start
()
self
.
tic
()
self
.
_simulate
UpgradeDecision_upgradeHostingSubscription
(
)
self
.
_simulate
Script
(
'UpgradeDecision_upgradeHostingSubscription'
,
'True'
)
try
:
self
.
portal
.
portal_alarms
.
slapos_
upgrade_decision_process
.
activeSense
()
self
.
portal
.
portal_alarms
.
slapos_
pdm_upgrade_decision_process_started
.
activeSense
()
self
.
tic
()
finally
:
self
.
_drop
UpgradeDecision_upgradeHostingSubscription
(
)
self
.
_drop
Script
(
'UpgradeDecision_upgradeHostingSubscription'
)
self
.
assertEqual
(
'Visited by UpgradeDecision_upgradeHostingSubscription'
,
upgrade_decision
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
...
...
@@ -86,52 +76,48 @@ return %s
upgrade_decision
.
start
()
self
.
tic
()
self
.
_simulate
UpgradeDecision_upgradeHostingSubscription
(
"False"
)
self
.
_simulate
UpgradeDecision_upgradeComputer
(
)
self
.
_simulate
Script
(
'UpgradeDecision_upgradeHostingSubscription'
,
'False'
)
self
.
_simulate
Script
(
'UpgradeDecision_upgradeComputer'
,
'True'
)
try
:
self
.
portal
.
portal_alarms
.
slapos_
upgrade_decision_process
.
activeSense
()
self
.
portal
.
portal_alarms
.
slapos_
pdm_upgrade_decision_process_started
.
activeSense
()
self
.
tic
()
finally
:
self
.
_drop
UpgradeDecision_upgradeHostingSubscription
(
)
self
.
_drop
UpgradeDecision_upgradeComputer
(
)
self
.
_drop
Script
(
'UpgradeDecision_upgradeHostingSubscription'
)
self
.
_drop
Script
(
'UpgradeDecision_upgradeComputer'
)
self
.
assertEqual
(
'Visited by UpgradeDecision_upgradeComputer'
,
upgrade_decision
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
_simulateComputer_checkAndCreateUpgradeDecision
(
self
):
script_name
=
'Computer_checkAndCreateUpgradeDecision'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
script_name
,
'*args, **kw'
,
'# Script body
\
n
'
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='%s') """
%
\
'Visited by Computer_checkAndCreateUpgradeDecision'
)
transaction
.
commit
()
def
test_alarm_upgrade_decision_process_planned
(
self
):
upgrade_decision
=
self
.
_makeUpgradeDecision
(
confirm
=
0
)
upgrade_decision
.
plan
()
self
.
tic
()
def
_dropComputer_checkAndCreateUpgradeDecision
(
self
):
script_name
=
'Computer_checkAndCreateUpgradeDecision'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
def
test_Alarm_computerCheckUpgradeSoftwareRelease
(
self
):
self
.
_simulateScript
(
'UpgradeDecision_notify'
)
try
:
self
.
portal
.
portal_alarms
.
slapos_pdm_upgrade_decision_process_planned
.
\
activeSense
()
self
.
tic
()
finally
:
self
.
_dropScript
(
'UpgradeDecision_notify'
)
self
.
assertEqual
(
'Visited by UpgradeDecision_notify'
,
upgrade_decision
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_computer_create_upgrade_decision
(
self
):
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
.
edit
(
allocation_scope
=
'open/public'
)
computer2
=
self
.
_makeComputer
(
self
.
generateNewId
())
computer2
.
edit
(
allocation_scope
=
'open/personal'
)
self
.
_simulateComputer_checkAndCreateUpgradeDecision
()
self
.
_simulateScript
(
'Computer_checkAndCreateUpgradeDecision'
)
try
:
self
.
portal
.
portal_alarms
.
slapos_pdm_computer_create_upgrade_decision
.
\
activeSense
()
self
.
tic
()
finally
:
self
.
_drop
Computer_checkAndCreateUpgradeDecision
(
)
self
.
_drop
Script
(
'Computer_checkAndCreateUpgradeDecision'
)
self
.
assertEqual
(
'Visited by Computer_checkAndCreateUpgradeDecision'
,
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
...
...
@@ -139,44 +125,24 @@ portal_workflow.doActionFor(context, action='edit_action', comment='%s') """ % \
self
.
assertNotEqual
(
'Visited by Computer_checkAndCreateUpgradeDecision'
,
computer2
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
_simulateComputer_hostingSubscriptionCreateUpgradeDecision
(
self
):
script_name
=
'Computer_hostingSubscriptionCreateUpgradeDecision'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
script_name
,
'*args, **kw'
,
'# Script body
\
n
'
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='%s') """
%
\
'Visited by Computer_hostingSubscriptionCreateUpgradeDecision'
)
transaction
.
commit
()
def
_dropComputer_hostingSubscriptionCreateUpgradeDecision
(
self
):
script_name
=
'Computer_hostingSubscriptionCreateUpgradeDecision'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
def
test_Alarm_computerCheckUpgradeHostingSubscription
(
self
):
def
test_alarm_hosting_subscription_create_upgrade_decision
(
self
):
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
.
edit
(
allocation_scope
=
'open/public'
)
computer2
=
self
.
_makeComputer
(
self
.
generateNewId
())
computer2
.
edit
(
allocation_scope
=
'open/personal'
)
self
.
_simulate
Computer_hostingSubscriptionCreateUpgradeDecision
(
)
self
.
_simulate
Script
(
'Computer_hostingSubscriptionCreateUpgradeDecision'
)
try
:
self
.
portal
.
portal_alarms
.
slapos_hosting_subscription_create_upgrade_decision
.
\
self
.
portal
.
portal_alarms
.
slapos_
pdm_
hosting_subscription_create_upgrade_decision
.
\
activeSense
()
self
.
tic
()
finally
:
self
.
_drop
Computer_hostingSubscriptionCreateUpgradeDecision
(
)
self
.
_drop
Script
(
'Computer_hostingSubscriptionCreateUpgradeDecision'
)
self
.
assertEqual
(
'Visited by Computer_hostingSubscriptionCreateUpgradeDecision'
,
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
self
.
assertNotEqual
(
'Visited by Computer_hostingSubscriptionCreateUpgradeDecision'
,
computer2
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
\ No newline at end of file
master/bt5/slapos_pdm/bt/revision
View file @
a7d9cd78
21
\ No newline at end of file
22
\ No newline at end of file
master/bt5/slapos_pdm/bt/template_path_list
View file @
a7d9cd78
portal_alarms/slapos_hosting_subscription_create_upgrade_decision
portal_alarms/slapos_manage_software_catalog
portal_alarms/slapos_pdm_computer_create_upgrade_decision
portal_alarms/slapos_upgrade_decision_process_planned
portal_alarms/slapos_upgrade_decision_process_started
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
software_product_module/template_software_product
software_release_module/template_software_release
\ 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