Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
18
Merge Requests
18
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
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 @@
...
@@ -20,7 +20,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<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>
<item>
<item>
<key>
<string>
periodicity_day_frequency
</string>
</key>
<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 @@
...
@@ -22,7 +22,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<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>
<item>
<item>
<key>
<string>
periodicity_day_frequency
</string>
</key>
<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 @@
...
@@ -22,7 +22,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<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>
<item>
<item>
<key>
<string>
periodicity_day_frequency
</string>
</key>
<key>
<string>
periodicity_day_frequency
</string>
</key>
...
...
master/bt5/slapos_pdm/TestTemplateItem/testSlapOSPDMAlarm.py
View file @
a7d9cd78
...
@@ -13,12 +13,13 @@ class TestSlapOSUpgradeDecisionProcess(testSlapOSMixin):
...
@@ -13,12 +13,13 @@ class TestSlapOSUpgradeDecisionProcess(testSlapOSMixin):
return
"%sTEST"
%
self
.
portal
.
portal_ids
.
generateNewId
(
return
"%sTEST"
%
self
.
portal
.
portal_ids
.
generateNewId
(
id_group
=
(
'slapos_core_test'
))
id_group
=
(
'slapos_core_test'
))
def
_makeUpgradeDecision
(
self
):
def
_makeUpgradeDecision
(
self
,
confirm
=
True
):
upgrade_decision
=
self
.
portal
.
\
upgrade_decision
=
self
.
portal
.
\
upgrade_decision_module
.
newContent
(
upgrade_decision_module
.
newContent
(
portal_type
=
"Upgrade Decision"
,
portal_type
=
"Upgrade Decision"
,
title
=
"TESTUPDE-%s"
%
self
.
new_id
)
title
=
"TESTUPDE-%s"
%
self
.
new_id
)
upgrade_decision
.
confirm
()
if
confirm
:
upgrade_decision
.
confirm
()
return
upgrade_decision
return
upgrade_decision
def
_makeComputer
(
self
,
new_id
):
def
_makeComputer
(
self
,
new_id
):
...
@@ -35,14 +36,8 @@ class TestSlapOSUpgradeDecisionProcess(testSlapOSMixin):
...
@@ -35,14 +36,8 @@ class TestSlapOSUpgradeDecisionProcess(testSlapOSMixin):
computer
.
validate
()
computer
.
validate
()
return
computer
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
():
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
...
@@ -55,11 +50,6 @@ return %s
...
@@ -55,11 +50,6 @@ return %s
"""
%
(
script_name
,
fake_return
))
"""
%
(
script_name
,
fake_return
))
transaction
.
commit
()
transaction
.
commit
()
def
_dropUpgradeDecision_upgradeHostingSubscription
(
self
):
self
.
_dropScript
(
'UpgradeDecision_upgradeHostingSubscription'
)
def
_dropUpgradeDecision_upgradeComputer
(
self
):
self
.
_dropScript
(
'UpgradeDecision_upgradeComputer'
)
def
_dropScript
(
self
,
script_name
):
def
_dropScript
(
self
,
script_name
):
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
...
@@ -71,12 +61,12 @@ return %s
...
@@ -71,12 +61,12 @@ return %s
upgrade_decision
.
start
()
upgrade_decision
.
start
()
self
.
tic
()
self
.
tic
()
self
.
_simulate
UpgradeDecision_upgradeHostingSubscription
(
)
self
.
_simulate
Script
(
'UpgradeDecision_upgradeHostingSubscription'
,
'True'
)
try
:
try
:
self
.
portal
.
portal_alarms
.
slapos_
upgrade_decision_process
.
activeSense
()
self
.
portal
.
portal_alarms
.
slapos_
pdm_upgrade_decision_process_started
.
activeSense
()
self
.
tic
()
self
.
tic
()
finally
:
finally
:
self
.
_drop
UpgradeDecision_upgradeHostingSubscription
(
)
self
.
_drop
Script
(
'UpgradeDecision_upgradeHostingSubscription'
)
self
.
assertEqual
(
self
.
assertEqual
(
'Visited by UpgradeDecision_upgradeHostingSubscription'
,
'Visited by UpgradeDecision_upgradeHostingSubscription'
,
upgrade_decision
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
upgrade_decision
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
...
@@ -86,52 +76,48 @@ return %s
...
@@ -86,52 +76,48 @@ return %s
upgrade_decision
.
start
()
upgrade_decision
.
start
()
self
.
tic
()
self
.
tic
()
self
.
_simulate
UpgradeDecision_upgradeHostingSubscription
(
"False"
)
self
.
_simulate
Script
(
'UpgradeDecision_upgradeHostingSubscription'
,
'False'
)
self
.
_simulate
UpgradeDecision_upgradeComputer
(
)
self
.
_simulate
Script
(
'UpgradeDecision_upgradeComputer'
,
'True'
)
try
:
try
:
self
.
portal
.
portal_alarms
.
slapos_
upgrade_decision_process
.
activeSense
()
self
.
portal
.
portal_alarms
.
slapos_
pdm_upgrade_decision_process_started
.
activeSense
()
self
.
tic
()
self
.
tic
()
finally
:
finally
:
self
.
_drop
UpgradeDecision_upgradeHostingSubscription
(
)
self
.
_drop
Script
(
'UpgradeDecision_upgradeHostingSubscription'
)
self
.
_drop
UpgradeDecision_upgradeComputer
(
)
self
.
_drop
Script
(
'UpgradeDecision_upgradeComputer'
)
self
.
assertEqual
(
self
.
assertEqual
(
'Visited by UpgradeDecision_upgradeComputer'
,
'Visited by UpgradeDecision_upgradeComputer'
,
upgrade_decision
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
upgrade_decision
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_upgrade_decision_process_planned
(
self
):
def
_simulateComputer_checkAndCreateUpgradeDecision
(
self
):
upgrade_decision
=
self
.
_makeUpgradeDecision
(
confirm
=
0
)
script_name
=
'Computer_checkAndCreateUpgradeDecision'
upgrade_decision
.
plan
()
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
tic
()
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
_dropComputer_checkAndCreateUpgradeDecision
(
self
):
self
.
_simulateScript
(
'UpgradeDecision_notify'
)
script_name
=
'Computer_checkAndCreateUpgradeDecision'
try
:
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_alarms
.
slapos_pdm_upgrade_decision_process_planned
.
\
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
activeSense
()
transaction
.
commit
()
self
.
tic
()
finally
:
def
test_Alarm_computerCheckUpgradeSoftwareRelease
(
self
):
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
=
self
.
_makeComputer
(
self
.
new_id
)
computer
.
edit
(
allocation_scope
=
'open/public'
)
computer
.
edit
(
allocation_scope
=
'open/public'
)
computer2
=
self
.
_makeComputer
(
self
.
generateNewId
())
computer2
=
self
.
_makeComputer
(
self
.
generateNewId
())
computer2
.
edit
(
allocation_scope
=
'open/personal'
)
computer2
.
edit
(
allocation_scope
=
'open/personal'
)
self
.
_simulateComputer_checkAndCreateUpgradeDecision
()
self
.
_simulateScript
(
'Computer_checkAndCreateUpgradeDecision'
)
try
:
try
:
self
.
portal
.
portal_alarms
.
slapos_pdm_computer_create_upgrade_decision
.
\
self
.
portal
.
portal_alarms
.
slapos_pdm_computer_create_upgrade_decision
.
\
activeSense
()
activeSense
()
self
.
tic
()
self
.
tic
()
finally
:
finally
:
self
.
_drop
Computer_checkAndCreateUpgradeDecision
(
)
self
.
_drop
Script
(
'Computer_checkAndCreateUpgradeDecision'
)
self
.
assertEqual
(
'Visited by Computer_checkAndCreateUpgradeDecision'
,
self
.
assertEqual
(
'Visited by Computer_checkAndCreateUpgradeDecision'
,
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
...
@@ -139,44 +125,24 @@ portal_workflow.doActionFor(context, action='edit_action', comment='%s') """ % \
...
@@ -139,44 +125,24 @@ portal_workflow.doActionFor(context, action='edit_action', comment='%s') """ % \
self
.
assertNotEqual
(
'Visited by Computer_checkAndCreateUpgradeDecision'
,
self
.
assertNotEqual
(
'Visited by Computer_checkAndCreateUpgradeDecision'
,
computer2
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
computer2
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
_simulateComputer_hostingSubscriptionCreateUpgradeDecision
(
self
):
def
test_alarm_hosting_subscription_create_upgrade_decision
(
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
):
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
.
edit
(
allocation_scope
=
'open/public'
)
computer
.
edit
(
allocation_scope
=
'open/public'
)
computer2
=
self
.
_makeComputer
(
self
.
generateNewId
())
computer2
=
self
.
_makeComputer
(
self
.
generateNewId
())
computer2
.
edit
(
allocation_scope
=
'open/personal'
)
computer2
.
edit
(
allocation_scope
=
'open/personal'
)
self
.
_simulate
Computer_hostingSubscriptionCreateUpgradeDecision
(
)
self
.
_simulate
Script
(
'Computer_hostingSubscriptionCreateUpgradeDecision'
)
try
:
try
:
self
.
portal
.
portal_alarms
.
slapos_hosting_subscription_create_upgrade_decision
.
\
self
.
portal
.
portal_alarms
.
slapos_
pdm_
hosting_subscription_create_upgrade_decision
.
\
activeSense
()
activeSense
()
self
.
tic
()
self
.
tic
()
finally
:
finally
:
self
.
_drop
Computer_hostingSubscriptionCreateUpgradeDecision
(
)
self
.
_drop
Script
(
'Computer_hostingSubscriptionCreateUpgradeDecision'
)
self
.
assertEqual
(
'Visited by Computer_hostingSubscriptionCreateUpgradeDecision'
,
self
.
assertEqual
(
'Visited by Computer_hostingSubscriptionCreateUpgradeDecision'
,
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
self
.
assertNotEqual
(
'Visited by Computer_hostingSubscriptionCreateUpgradeDecision'
,
self
.
assertNotEqual
(
'Visited by Computer_hostingSubscriptionCreateUpgradeDecision'
,
computer2
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
computer2
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
\ No newline at end of file
master/bt5/slapos_pdm/bt/revision
View file @
a7d9cd78
21
22
\ No newline at end of file
\ 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_manage_software_catalog
portal_alarms/slapos_pdm_computer_create_upgrade_decision
portal_alarms/slapos_pdm_computer_create_upgrade_decision
portal_alarms/slapos_upgrade_decision_process_planned
portal_alarms/slapos_pdm_hosting_subscription_create_upgrade_decision
portal_alarms/slapos_upgrade_decision_process_started
portal_alarms/slapos_pdm_upgrade_decision_process_planned
portal_alarms/slapos_pdm_upgrade_decision_process_started
software_product_module/template_software_product
software_product_module/template_software_product
software_release_module/template_software_release
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