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
Guillaume Hervier
slapos.core
Commits
2f7f421d
Commit
2f7f421d
authored
Nov 10, 2014
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_pdm: Rename alarms and update test
Conflicts: master/bt5/slapos_pdm/bt/revision
parent
37712722
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
76 deletions
+42
-76
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/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 @
2f7f421d
...
@@ -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 @
2f7f421d
...
@@ -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 @
2f7f421d
...
@@ -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 @
2f7f421d
...
@@ -13,11 +13,12 @@ class TestSlapOSUpgradeDecisionProcess(testSlapOSMixin):
...
@@ -13,11 +13,12 @@ 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
)
if
confirm
:
upgrade_decision
.
confirm
()
upgrade_decision
.
confirm
()
return
upgrade_decision
return
upgrade_decision
...
@@ -36,13 +37,7 @@ class TestSlapOSUpgradeDecisionProcess(testSlapOSMixin):
...
@@ -36,13 +37,7 @@ class TestSlapOSUpgradeDecisionProcess(testSlapOSMixin):
return
computer
return
computer
def
_simulateUpgradeDecision_upgradeHostingSubscription
(
self
,
fake_return
=
"True"
):
def
_simulateScript
(
self
,
script_name
,
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
):
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
):
upgrade_decision
=
self
.
_makeUpgradeDecision
(
confirm
=
0
)
upgrade_decision
.
plan
()
self
.
tic
()
def
_simulateComputer_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
.
\
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
activeSense
()
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
self
.
tic
()
script_name
,
finally
:
'*args, **kw'
,
self
.
_dropScript
(
'UpgradeDecision_notify'
)
'# Script body
\
n
'
"""portal_workflow = context.portal_workflow
self
.
assertEqual
(
'Visited by UpgradeDecision_notify'
,
portal_workflow.doActionFor(context, action='edit_action', comment='%s') """
%
\
upgrade_decision
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
'Visited by Computer_checkAndCreateUpgradeDecision'
)
transaction
.
commit
()
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
):
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,39 +125,20 @@ portal_workflow.doActionFor(context, action='edit_action', comment='%s') """ % \
...
@@ -139,39 +125,20 @@ 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'
])
...
@@ -179,4 +146,3 @@ portal_workflow.doActionFor(context, action='edit_action', comment='%s') """ % \
...
@@ -179,4 +146,3 @@ portal_workflow.doActionFor(context, action='edit_action', comment='%s') """ % \
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/template_path_list
View file @
2f7f421d
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