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
0f7c72df
Commit
0f7c72df
authored
Feb 07, 2023
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
Reduce allocation scope usage
See merge request
nexedi/slapos.core!486
parents
06a27d31
8955cfe7
Pipeline
#26466
failed with stage
in 0 seconds
Changes
25
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
443 additions
and
888 deletions
+443
-888
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingAlarm.py
.../portal_components/test.erp5.testSlapOSAccountingAlarm.py
+40
-37
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
...omponents/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
+8
-0
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
...teItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
+52
-40
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAlarm.py
...eItem/portal_components/test.erp5.testSlapOSCloudAlarm.py
+131
-320
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAllocationAlarm.py
...al_components/test.erp5.testSlapOSCloudAllocationAlarm.py
+16
-0
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAllocationAlarm.xml
...l_components/test.erp5.testSlapOSCloudAllocationAlarm.xml
+3
-24
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudPersonSlapInterfaceWorkflow.py
...s/test.erp5.testSlapOSCloudPersonSlapInterfaceWorkflow.py
+4
-4
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudPersonSlapInterfaceWorkflow.xml
.../test.erp5.testSlapOSCloudPersonSlapInterfaceWorkflow.xml
+3
-24
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputeNode_checkState.py
...tal_skins/slapos_crm_monitoring/ComputeNode_checkState.py
+0
-4
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SupportRequest_recheckMonitoring.py
...slapos_crm_monitoring/SupportRequest_recheckMonitoring.py
+0
-13
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
...ateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
+45
-9
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5Alarm.py
...teItem/portal_components/test.erp5.testSlapOSERP5Alarm.py
+11
-24
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5Alarm.xml
...eItem/portal_components/test.erp5.testSlapOSERP5Alarm.xml
+3
-24
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5InteractionWorkflow.py
...components/test.erp5.testSlapOSERP5InteractionWorkflow.py
+11
-10
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/slapos_erp5_interaction_workflow/script_ComputeNode_updateAllocation.py
...teraction_workflow/script_ComputeNode_updateAllocation.py
+8
-9
master/bt5/slapos_jio/ActionTemplateItem/portal_types/Compute%20Node/update_allocation_scope.xml
...m/portal_types/Compute%20Node/update_allocation_scope.xml
+0
-85
master/bt5/slapos_jio/ActionTemplateItem/portal_types/Compute%20Node/update_category.xml
...plateItem/portal_types/Compute%20Node/update_category.xml
+0
-85
master/bt5/slapos_jio/bt/template_action_path_list
master/bt5/slapos_jio/bt/template_action_path_list
+0
-2
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_ComputeNodeCheckUpgradeSoftwareRelease.py
...lapos_pdm/Alarm_ComputeNodeCheckUpgradeSoftwareRelease.py
+6
-5
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/InstanceTree_createUpgradeDecision.py
...al_skins/slapos_pdm/InstanceTree_createUpgradeDecision.py
+0
-3
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMAlarm.py
...ateItem/portal_components/test.erp5.testSlapOSPDMAlarm.py
+84
-114
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMAlarm.xml
...teItem/portal_components/test.erp5.testSlapOSPDMAlarm.xml
+3
-24
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
...ents/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
+9
-1
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.xml
...nts/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.xml
+3
-24
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_reviewUpgrade.py
...nterface_workflow/script_UpgradeDecision_reviewUpgrade.py
+3
-3
No files found.
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingAlarm.py
View file @
0f7c72df
...
...
@@ -1276,6 +1276,7 @@ class TestSlapOSUpdateOpenSaleOrderPeriod(SlapOSTestCaseMixin):
open_order
=
self
.
createOpenOrder
()
open_order
.
OpenSaleOrder_updatePeriod
()
@
simulateByEditWorkflowMark
(
'Person_storeOpenSaleOrderJournal'
)
def
test_updatePeriod_validated
(
self
):
open_order
=
self
.
createOpenOrder
()
person
=
self
.
portal
.
person_module
.
template_member
\
...
...
@@ -1284,14 +1285,12 @@ class TestSlapOSUpdateOpenSaleOrderPeriod(SlapOSTestCaseMixin):
destination_decision_value
=
person
,
)
script_name
=
"Person_storeOpenSaleOrderJournal"
self
.
_simulateScript
(
script_name
)
try
:
open_order
.
OpenSaleOrder_updatePeriod
()
finally
:
self
.
_dropScript
(
script_name
)
self
.
assertScriptVisited
(
person
,
script_name
)
open_order
.
OpenSaleOrder_updatePeriod
()
self
.
assertEqual
(
'Visited by Person_storeOpenSaleOrderJournal'
,
person
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
@
simulateByEditWorkflowMark
(
'Person_storeOpenSaleOrderJournal'
)
def
test_updatePeriod_invalidated
(
self
):
open_order
=
self
.
createOpenOrder
()
person
=
self
.
portal
.
person_module
.
template_member
\
...
...
@@ -1300,14 +1299,11 @@ class TestSlapOSUpdateOpenSaleOrderPeriod(SlapOSTestCaseMixin):
destination_decision_value
=
person
,
)
open_order
.
invalidate
()
open_order
.
OpenSaleOrder_updatePeriod
()
script_name
=
"Person_storeOpenSaleOrderJournal"
self
.
_simulateScript
(
script_name
)
try
:
open_order
.
OpenSaleOrder_updatePeriod
()
finally
:
self
.
_dropScript
(
script_name
)
self
.
assertScriptNotVisited
(
person
,
script_name
)
self
.
assertNotEqual
(
'Visited by Person_storeOpenSaleOrderJournal'
,
person
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm
(
self
):
open_order
=
self
.
createOpenOrder
()
...
...
@@ -1351,39 +1347,46 @@ class TestSlapOSReindexOpenSaleOrder(SlapOSTestCaseMixin):
)
return
open_order
def
_simulateScript
(
self
,
script_name
,
fake_return
=
"False"
):
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
,
'uid=None,*args, **kwargs'
,
'# Script body
\
n
'
"""portal_workflow = context.portal_workflow
document = context.portal_catalog.getResultValue(uid=uid)
portal_workflow.doActionFor(document, action='edit_action', comment='Visited by %s') """
%
script_name
)
transaction
.
commit
()
def
test_alarm
(
self
):
open_order
=
self
.
createOpenOrder
()
self
.
tic
()
# Jut wait a bit so the line has a different timestamp > 1 sec.
time
.
sleep
(
1
)
open_order
.
newContent
(
portal_type
=
"Open Sale Order Line"
)
open_order
_line
=
open_order
.
newContent
(
portal_type
=
"Open Sale Order Line"
)
self
.
tic
()
script_name
=
"OpenSaleOrder_reindexIfIndexedBeforeLine"
alarm
=
self
.
portal
.
portal_alarms
.
slapos_reindex_open_sale_order
self
.
_test_alarm
(
alarm
,
open_order
,
script_name
)
order
=
self
.
portal
.
portal_catalog
(
uid
=
open_order
.
getUid
(),
select_dict
=
{
'indexation_timestamp'
:
None
})[
0
]
line
=
self
.
portal
.
portal_catalog
(
uid
=
open_order_line
.
getUid
(),
select_dict
=
{
'indexation_timestamp'
:
None
})[
0
]
self
.
assertTrue
(
order
.
indexation_timestamp
<
line
.
indexation_timestamp
)
self
.
portal
.
portal_alarms
.
slapos_reindex_open_sale_order
.
activeSense
()
self
.
tic
()
order
=
self
.
portal
.
portal_catalog
(
uid
=
open_order
.
getUid
(),
select_dict
=
{
'indexation_timestamp'
:
None
})[
0
]
line
=
self
.
portal
.
portal_catalog
(
uid
=
open_order_line
.
getUid
(),
select_dict
=
{
'indexation_timestamp'
:
None
})[
0
]
self
.
assertTrue
(
order
.
indexation_timestamp
>
line
.
indexation_timestamp
,
"%s %s"
%
(
order
.
indexation_timestamp
,
line
.
indexation_timestamp
))
def
test_alarm_no_line
(
self
):
open_order
=
self
.
createOpenOrder
()
self
.
tic
()
script_name
=
"OpenSaleOrder_reindexIfIndexedBeforeLine"
alarm
=
self
.
portal
.
portal_alarms
.
slapos_reindex_open_sale_order
self
.
_test_alarm_not_visited
(
alarm
,
open_order
,
script_name
)
# Rather them test the alarm with fake script, directly
# test the ERP5Site_zGetOpenOrderWithModifiedLineUid code.
open_order_with_modified_line_uid_list
=
[
i
.
uid
for
i
in
\
self
.
portal
.
ERP5Site_zGetOpenOrderWithModifiedLineUid
()]
self
.
assertNotIn
(
open_order
.
getUid
(),
open_order_with_modified_line_uid_list
)
class
TestSlapOSGeneratePackingListFromTioXML
(
SlapOSTestCaseMixin
):
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
View file @
0f7c72df
...
...
@@ -147,6 +147,8 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
server
.
edit
(
allocation_scope
=
'open/public'
)
self
.
assertEqual
(
'open/public'
,
server
.
getAllocationScope
())
# Called by alarm
server
.
ComputeNode_checkAndUpdateCapacityScope
()
self
.
assertEqual
(
'open'
,
server
.
getCapacityScope
())
self
.
tic
()
...
...
@@ -155,6 +157,8 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
server
.
edit
(
allocation_scope
=
'open/subscription'
)
self
.
assertEqual
(
'open/subscription'
,
server
.
getAllocationScope
())
# Called by alarm
server
.
ComputeNode_checkAndUpdateCapacityScope
()
self
.
assertEqual
(
'open'
,
server
.
getCapacityScope
())
self
.
tic
()
...
...
@@ -163,6 +167,8 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
server
.
edit
(
allocation_scope
=
'open/personal'
,
subject_list
=
[])
self
.
assertEqual
(
'open/personal'
,
server
.
getAllocationScope
())
# Called by alarm
server
.
ComputeNode_checkAndUpdateCapacityScope
()
self
.
assertEqual
(
'open'
,
server
.
getCapacityScope
())
self
.
tic
()
...
...
@@ -173,6 +179,8 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
server
.
edit
(
allocation_scope
=
'open/friend'
,
subject_list
=
friend_list
)
self
.
assertEqual
(
'open/friend'
,
server
.
getAllocationScope
())
# Called by alarm
server
.
ComputeNode_checkAndUpdateCapacityScope
()
self
.
assertEqual
(
'open'
,
server
.
getCapacityScope
())
self
.
assertSameSet
(
friend_list
,
server
.
getSubjectList
())
self
.
tic
()
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
View file @
0f7c72df
...
...
@@ -78,6 +78,40 @@ def withAbort(func):
self
.
abort
()
return
wrapped
class
TemporaryAlarmScript
(
object
):
"""
Context manager for temporary python scripts
"""
def
__init__
(
self
,
portal
,
script_name
,
fake_return
=
""
,
attribute
=
None
):
self
.
script_name
=
script_name
self
.
portal
=
portal
self
.
fake_return
=
fake_return
self
.
attribute
=
attribute
def
__enter__
(
self
):
if
self
.
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
self
.
script_name
)
if
self
.
attribute
is
None
:
content
=
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by %s')
return %s"""
%
(
self
.
script_name
,
self
.
fake_return
)
else
:
content
=
"""portal_workflow = context.portal_workflow
context.edit(%s='Visited by %s')
return %s"""
%
(
self
.
attribute
,
self
.
script_name
,
self
.
fake_return
)
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
self
.
script_name
,
'*args, **kwargs'
,
'# Script body
\
n
'
+
content
)
transaction
.
commit
()
def
__exit__
(
self
,
exc_type
,
exc_value
,
traceback
):
if
self
.
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
self
.
script_name
)
transaction
.
commit
()
class
SlapOSTestCaseMixin
(
testSlapOSMixin
):
expected_html_payzen_redirect_page
=
None
...
...
@@ -620,53 +654,31 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
resource
=
'foo/bar'
,
)
# Set of methods to help test alarms and to see if the script was called
def
_simulateScript
(
self
,
script_name
,
fake_return
=
""
):
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, **kwargs'
,
'# Script body
\
n
'
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by %s')
return %s"""
%
(
script_name
,
fake_return
))
transaction
.
commit
()
def
_dropScript
(
self
,
script_name
):
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
def
assertScriptVisited
(
self
,
document
,
script_name
):
self
.
assertEqual
(
'Visited by %s'
%
script_name
,
document
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
assertScriptNotVisited
(
self
,
document
,
script_name
):
self
.
assertNotEqual
(
'Visited by %s'
%
script_name
,
document
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
_test_alarm
(
self
,
alarm
,
document
,
script_name
):
def
_test_alarm
(
self
,
alarm
,
document
,
script_name
,
attribute
=
None
):
self
.
tic
()
self
.
_simulateScript
(
script_name
)
try
:
with
TemporaryAlarmScript
(
self
.
portal
,
script_name
,
attribute
=
attribute
):
alarm
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropScript
(
script_name
)
self
.
assertScriptVisited
(
document
,
script_name
)
if
attribute
is
None
:
content
=
document
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
]
else
:
content
=
document
.
getProperty
(
attribute
)
self
.
assertEqual
(
'Visited by %s'
%
script_name
,
content
)
def
_test_alarm_not_visited
(
self
,
alarm
,
document
,
script_name
):
def
_test_alarm_not_visited
(
self
,
alarm
,
document
,
script_name
,
attribute
=
None
):
self
.
tic
()
self
.
_simulateScript
(
script_name
)
try
:
with
TemporaryAlarmScript
(
self
.
portal
,
script_name
,
attribute
=
attribute
):
alarm
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropScript
(
script_name
)
self
.
assertScriptNotVisited
(
document
,
script_name
)
if
attribute
is
None
:
content
=
document
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
]
else
:
content
=
document
.
getProperty
(
attribute
)
self
.
assertNotEqual
(
'Visited by %s'
%
script_name
,
content
)
def
restoreAccountingTemplatesOnPreferences
(
self
):
self
.
login
()
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAlarm.py
View file @
0f7c72df
This diff is collapsed.
Click to expand it.
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAllocationAlarm.py
View file @
0f7c72df
...
...
@@ -209,6 +209,10 @@ return True""" )
self
.
software_instance
.
getUrlString
())
self
.
compute_node
.
edit
(
allocation_scope
=
'open/personal'
,
source_administration
=
self
.
person_user
.
getRelativeUrl
())
self
.
compute_node
.
setAccessStatus
(
"#access ok"
)
self
.
tic
()
self
.
compute_node
.
ComputeNode_checkAndUpdateCapacityScope
()
self
.
assertEqual
(
self
.
compute_node
.
getCapacityScope
(),
'open'
)
self
.
tic
()
self
.
assertEqual
(
None
,
self
.
software_instance
.
getAggregateValue
(
...
...
@@ -226,6 +230,10 @@ return True""" )
self
.
partition
)
self
.
compute_node
.
edit
(
allocation_scope
=
'open/personal'
,
source_administration
=
self
.
person_user
.
getRelativeUrl
())
self
.
compute_node
.
setAccessStatus
(
"#access ok"
)
self
.
tic
()
self
.
compute_node
.
ComputeNode_checkAndUpdateCapacityScope
()
self
.
assertEqual
(
self
.
compute_node
.
getCapacityScope
(),
'open'
)
self
.
tic
()
self
.
assertEqual
(
None
,
self
.
software_instance
.
getAggregateValue
(
...
...
@@ -259,6 +267,10 @@ return True""" )
source_administration
=
person_user
.
getRelativeUrl
(),
destination_section
=
self
.
person_user
.
getRelativeUrl
(),
allocation_scope
=
'open/friend'
)
self
.
compute_node
.
setAccessStatus
(
"#access ok"
)
self
.
tic
()
self
.
compute_node
.
ComputeNode_checkAndUpdateCapacityScope
()
self
.
assertEqual
(
self
.
compute_node
.
getCapacityScope
(),
'open'
)
self
.
tic
()
self
.
assertEqual
(
None
,
self
.
software_instance
.
getAggregateValue
(
...
...
@@ -292,6 +304,10 @@ return True""" )
source_administration
=
person_user
.
getRelativeUrl
(),
destination_section
=
self
.
person_user
.
getRelativeUrl
(),
allocation_scope
=
'open/friend'
)
self
.
compute_node
.
setAccessStatus
(
"#access ok"
)
self
.
tic
()
self
.
compute_node
.
ComputeNode_checkAndUpdateCapacityScope
()
self
.
assertEqual
(
self
.
compute_node
.
getCapacityScope
(),
'open'
)
self
.
tic
()
self
.
assertEqual
(
None
,
self
.
software_instance
.
getAggregateValue
(
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAllocationAlarm.xml
View file @
0f7c72df
...
...
@@ -6,12 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSCloudAllocationAlarm
</string>
</value>
...
...
@@ -55,28 +49,13 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -89,7 +68,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -98,7 +77,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudPersonSlapInterfaceWorkflow.py
View file @
0f7c72df
...
...
@@ -641,7 +641,7 @@ class TestSlapOSCorePersonRequestComputeNode(SlapOSTestCaseMixin):
self
.
assertEqual
(
'COMP-%s'
%
(
previous_id
+
1
),
compute_node
.
getReference
())
self
.
assertEqual
(
'validated'
,
compute_node
.
getValidationState
())
self
.
assertEqual
(
'open/personal'
,
compute_node
.
getAllocationScope
())
self
.
assertEqual
(
'
open
'
,
compute_node
.
getCapacityScope
())
self
.
assertEqual
(
'
close
'
,
compute_node
.
getCapacityScope
())
def
test_request_notReindexedCompute
(
self
):
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
...
...
@@ -682,7 +682,7 @@ class TestSlapOSCorePersonRequestComputeNode(SlapOSTestCaseMixin):
self
.
assertEqual
(
'COMP-%s'
%
(
previous_id
+
1
),
compute_node
.
getReference
())
self
.
assertEqual
(
'validated'
,
compute_node
.
getValidationState
())
self
.
assertEqual
(
'open/personal'
,
compute_node
.
getAllocationScope
())
self
.
assertEqual
(
'
open
'
,
compute_node
.
getCapacityScope
())
self
.
assertEqual
(
'
close
'
,
compute_node
.
getCapacityScope
())
self
.
tic
()
...
...
@@ -708,7 +708,7 @@ class TestSlapOSCorePersonRequestComputeNode(SlapOSTestCaseMixin):
self
.
assertEqual
(
'COMP-%s'
%
(
previous_id
+
1
),
compute_node
.
getReference
())
self
.
assertEqual
(
'validated'
,
compute_node
.
getValidationState
())
self
.
assertEqual
(
'open/personal'
,
compute_node
.
getAllocationScope
())
self
.
assertEqual
(
'
open
'
,
compute_node
.
getCapacityScope
())
self
.
assertEqual
(
'
close
'
,
compute_node
.
getCapacityScope
())
# and now another one
person
.
requestComputeNode
(
compute_node_title
=
compute_node_title2
)
...
...
@@ -735,7 +735,7 @@ class TestSlapOSCorePersonRequestComputeNode(SlapOSTestCaseMixin):
self
.
assertEqual
(
'COMP-%s'
%
(
previous_id
+
2
),
compute_node2
.
getReference
())
self
.
assertEqual
(
'validated'
,
compute_node2
.
getValidationState
())
self
.
assertEqual
(
'open/personal'
,
compute_node2
.
getAllocationScope
())
self
.
assertEqual
(
'
open
'
,
compute_node2
.
getCapacityScope
())
self
.
assertEqual
(
'
close
'
,
compute_node2
.
getCapacityScope
())
def
test_request_duplicatedComputeNode
(
self
):
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudPersonSlapInterfaceWorkflow.xml
View file @
0f7c72df
...
...
@@ -6,12 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSCloudPersonSlapInterfaceWorkflow
</string>
</value>
...
...
@@ -61,28 +55,13 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -95,7 +74,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -104,7 +83,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputeNode_checkState.py
View file @
0f7c72df
...
...
@@ -7,10 +7,6 @@ if not person or \
portal
.
ERP5Site_isSupportRequestCreationClosed
():
return
if
context
.
getAllocationScope
(
"open"
).
startswith
(
"close"
):
context
.
setMonitorScope
(
"disabled"
)
return
reference
=
context
.
getReference
()
compute_node_title
=
context
.
getTitle
()
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SupportRequest_recheckMonitoring.py
View file @
0f7c72df
#
# XXX This ticket contains dupplicated coded found arround SlapOS
# It is required to rewrite this in a generic way.
# See also: InstanceTree_checkSoftwareInstanceState
# See also: ComputeNode_checkState
#
from
DateTime
import
DateTime
if
context
.
getSimulationState
()
==
"invalidated"
:
...
...
@@ -103,17 +96,11 @@ if aggregate_portal_type == "Instance Tree":
if
instance
.
getAggregate
()
is
not
None
:
compute_node
=
instance
.
getAggregateValue
().
getParentValue
()
if
instance
.
getPortalType
()
==
"Software Instance"
and
\
compute_node
.
getAllocationScope
()
in
[
"open/public"
,
"open/friend"
,
"open/subscription"
]
and
\
instance
.
getSlapState
()
==
"start_requested"
and
\
instance
.
SoftwareInstance_hasReportedError
():
message_list
.
append
(
"%s has error (%s, %s at %s scope %s)"
%
(
instance
.
getReference
(),
instance
.
getTitle
(),
instance
.
getUrlString
(),
compute_node
.
getReference
(),
compute_node
.
getAllocationScope
()))
if
instance
.
getPortalType
()
==
"Software Instance"
and
\
compute_node
.
getAllocationScope
()
in
[
"closed/outdated"
,
"open/personal"
]
and
\
instance
.
getSlapState
()
==
"start_requested"
and
\
instance
.
SoftwareInstance_hasReportedError
():
message_list
.
append
(
"%s on a %s compute_node"
%
(
instance
.
getReference
(),
compute_node
.
getAllocationScope
())
)
else
:
message_list
.
append
(
"%s is not allocated"
%
instance
.
getReference
())
return
","
.
join
(
message_list
)
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
View file @
0f7c72df
...
...
@@ -502,6 +502,19 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(SlapOSTestCaseMixinWithAbort)
slapos_crm_check_compute_node_state
self
.
_test_alarm
(
alarm
,
self
.
compute_node
,
"ComputeNode_checkState"
)
def
_test_alarm_check_compute_node_state_selected
(
self
,
allocation_scope
,
monitor_scope
=
None
):
self
.
_makeComputeNode
()
self
.
compute_node
.
edit
(
allocation_scope
=
allocation_scope
)
self
.
tic
()
if
monitor_scope
is
not
None
:
self
.
compute_node
.
edit
(
monitor_scope
=
monitor_scope
)
self
.
tic
()
alarm
=
self
.
portal
.
portal_alarms
.
\
slapos_crm_check_compute_node_state
self
.
_test_alarm
(
alarm
,
self
.
compute_node
,
"ComputeNode_checkState"
)
def
_test_alarm_check_compute_node_state_not_selected
(
self
,
allocation_scope
,
monitor_scope
=
None
):
self
.
_makeComputeNode
()
...
...
@@ -532,15 +545,15 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(SlapOSTestCaseMixinWithAbort)
def
test_alarm_check_compute_node_state_closed_forever_compute_node
(
self
):
self
.
_test_alarm_check_compute_node_state_not_selected
(
allocation_scope
=
'close
d
/forever'
)
allocation_scope
=
'close/forever'
)
def
test_alarm_check_compute_node_state_closed_mantainence_compute_node
(
self
):
self
.
_test_alarm_check_compute_node_state_
not_
selected
(
allocation_scope
=
'close
d
/maintenance'
)
self
.
_test_alarm_check_compute_node_state_selected
(
allocation_scope
=
'close/maintenance'
)
def
test_alarm_check_compute_node_state_closed_termination_compute_node
(
self
):
self
.
_test_alarm_check_compute_node_state_
not_
selected
(
allocation_scope
=
'close
d
/termination'
)
self
.
_test_alarm_check_compute_node_state_selected
(
allocation_scope
=
'close/termination'
)
class
TestSlapOSCrmMonitoringCheckComputeNodeSoftwareInstallation
(
SlapOSTestCaseMixinWithAbort
):
...
...
@@ -601,25 +614,48 @@ class TestSlapOSCrmMonitoringCheckComputeNodeSoftwareInstallation(SlapOSTestCase
slapos_crm_check_software_installation_state
self
.
_test_alarm_not_visited
(
alarm
,
self
.
compute_node
,
"ComputeNode_checkSoftwareInstallationState"
)
def
_test_alarm_not_run_on_close
(
self
,
allocation_scope
):
def
_test_alarm_not_run_on_close
(
self
,
allocation_scope
,
monitor_scope
=
None
):
self
.
_makeComputeNode
()
self
.
compute_node
.
edit
(
allocation_scope
=
allocation_scope
)
self
.
tic
()
if
monitor_scope
is
not
None
:
self
.
compute_node
.
edit
(
monitor_scope
=
monitor_scope
)
self
.
tic
()
alarm
=
self
.
portal
.
portal_alarms
.
\
slapos_crm_check_software_installation_state
self
.
_test_alarm_not_visited
(
alarm
,
self
.
compute_node
,
"ComputeNode_checkSoftwareInstallationState"
)
def
_test_alarm_run_on_close
(
self
,
allocation_scope
,):
self
.
_makeComputeNode
()
self
.
compute_node
.
edit
(
allocation_scope
=
allocation_scope
)
self
.
tic
()
alarm
=
self
.
portal
.
portal_alarms
.
\
slapos_crm_check_software_installation_state
self
.
_test_alarm
(
alarm
,
self
.
compute_node
,
"ComputeNode_checkSoftwareInstallationState"
)
def
test_alarm_not_run_on_close_forever
(
self
):
self
.
_test_alarm_not_run_on_close
(
'close/forever'
)
def
test_alarm_not_run_on_close_maintainence
(
self
):
self
.
_test_alarm_not_run_on_close
(
'close/maintenence'
)
self
.
_test_alarm_not_run_on_close
(
'close/maintenence'
,
monitor_scope
=
"disabled"
)
def
test_alarm_not_run_on_close_outdated
(
self
):
self
.
_test_alarm_not_run_on_close
(
'close/outdated'
)
self
.
_test_alarm_not_run_on_close
(
'close/outdated'
,
monitor_scope
=
"disabled"
)
def
test_alarm_not_run_on_close_termination
(
self
):
self
.
_test_alarm_not_run_on_close
(
'close/termination'
)
self
.
_test_alarm_not_run_on_close
(
'close/termination'
,
monitor_scope
=
"disabled"
)
def
test_alarm_run_on_close_maintainence
(
self
):
self
.
_test_alarm_run_on_close
(
'close/maintenence'
)
def
test_alarm_run_on_close_outdated
(
self
):
self
.
_test_alarm_run_on_close
(
'close/outdated'
)
def
test_alarm_run_on_close_termination
(
self
):
self
.
_test_alarm_run_on_close
(
'close/termination'
)
class
TestSlapOSCrmMonitoringCheckInstanceInError
(
SlapOSTestCaseMixinWithAbort
):
...
...
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5Alarm.py
View file @
0f7c72df
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
import
transaction
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixinWithAbort
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
DateTime
import
DateTime
from
zExceptions
import
Unauthorized
class
TestSlapOSERP5CleanupActiveProcess
(
SlapOSTestCaseMixinWithAbort
):
def
_simulateActiveProcess_deleteSelf
(
self
):
script_name
=
'ActiveProcess_deleteSelf'
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, **kwargs'
,
'# Script body
\
n
'
"""description = '%s
\
\
nVisited by ActiveProcess_deleteSelf' % context.getDescription()
context.edit(description=description)"""
)
transaction
.
commit
()
def
_dropActiveProcess_deleteSelf
(
self
):
script_name
=
'ActiveProcess_deleteSelf'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
def
check_cleanup_active_process_alarm
(
self
,
date
,
assert_method
):
def
check_cleanup_active_process_alarm
(
self
,
date
,
test_method
):
def
verify_getCreationDate_call
(
*
args
,
**
kwargs
):
return
date
ActiveProcessClass
=
self
.
portal
.
portal_types
.
getPortalTypeClass
(
...
...
@@ -44,6 +24,13 @@ context.edit(description=description)""")
)
self
.
assertEqual
(
active_process
.
getCreationDate
(),
date
)
test_method
(
self
.
portal
.
portal_alarms
.
slapos_erp5_cleanup_active_process
,
active_process
,
'ActiveProcess_deleteSelf'
,
attribute
=
'description'
)
"""
self.tic()
self._simulateActiveProcess_deleteSelf()
try:
...
...
@@ -56,13 +43,13 @@ context.edit(description=description)""")
assert_method(active_process.getDescription('').
\
endswith("Visited by ActiveProcess_deleteSelf"),
active_process
.
getDescription
(
''
))
active_process.getDescription(''))
"""
def
test_alarm_old_active_process
(
self
):
self
.
check_cleanup_active_process_alarm
(
DateTime
()
-
22
,
self
.
assertTrue
)
self
.
check_cleanup_active_process_alarm
(
DateTime
()
-
22
,
self
.
_test_alarm
)
def
test_alarm_new_active_process
(
self
):
self
.
check_cleanup_active_process_alarm
(
DateTime
()
-
20
,
self
.
assertFalse
)
self
.
check_cleanup_active_process_alarm
(
DateTime
()
-
20
,
self
.
_test_alarm_not_visited
)
class
TestSlapOSERP5ActiveProcess_deleteSelf
(
SlapOSTestCaseMixinWithAbort
):
...
...
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5Alarm.xml
View file @
0f7c72df
...
...
@@ -6,12 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSERP5Alarm
</string>
</value>
...
...
@@ -55,28 +49,13 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -89,7 +68,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -98,7 +77,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5InteractionWorkflow.py
View file @
0f7c72df
...
...
@@ -47,7 +47,7 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
compute_node
.
edit
(
allocation_scope
=
allocation_scope
)
self
.
commit
()
self
.
assertEqual
(
compute_node
.
getCapacityScope
(),
'
open
'
)
self
.
assertEqual
(
compute_node
.
getCapacityScope
(),
'
close
'
)
self
.
assertEqual
(
compute_node
.
getMonitorScope
(),
'enabled'
)
return
compute_node
...
...
@@ -96,7 +96,7 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
self
.
commit
()
self
.
assertEqual
(
compute_node
.
getCapacityScope
(),
'close'
)
self
.
assertEqual
(
compute_node
.
getMonitorScope
(),
'
dis
abled'
)
self
.
assertEqual
(
compute_node
.
getMonitorScope
(),
'
en
abled'
)
self
.
commit
()
compute_node
.
edit
(
allocation_scope
=
None
)
self
.
commit
()
...
...
@@ -107,8 +107,8 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
compute_node
.
edit
(
allocation_scope
=
'open/personal'
)
self
.
commit
()
self
.
assertEqual
(
compute_node
.
getCapacityScope
(),
'
open
'
)
self
.
assertEqual
(
compute_node
.
getMonitorScope
(),
'
dis
abled'
)
self
.
assertEqual
(
compute_node
.
getCapacityScope
(),
'
close
'
)
self
.
assertEqual
(
compute_node
.
getMonitorScope
(),
'
en
abled'
)
return
compute_node
def
test_ComputeNode_setAllocationScope_personal
(
self
):
...
...
@@ -169,7 +169,7 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
compute_node
.
edit
(
allocation_scope
=
'open/friend'
)
self
.
commit
()
self
.
assertEqual
(
compute_node
.
getCapacityScope
(),
'
open
'
)
self
.
assertEqual
(
compute_node
.
getCapacityScope
(),
'
close
'
)
self
.
assertEqual
(
compute_node
.
getMonitorScope
(),
'enabled'
)
return
compute_node
...
...
@@ -205,7 +205,8 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
def
_test_ComputeNode_setAllocationScope_closed
(
self
,
source_administration
=
None
,
allocation_scope
=
"close/forever"
,
subject_list
=
None
):
subject_list
=
None
,
monitor_scope
=
'enabled'
):
compute_node
=
self
.
portal
.
compute_node_module
.
newContent
(
portal_type
=
'Compute Node'
,
capacity_scope
=
None
,
monitor_scope
=
None
,
...
...
@@ -217,7 +218,7 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
self
.
commit
()
self
.
assertEqual
(
compute_node
.
getCapacityScope
(),
'close'
)
self
.
assertEqual
(
compute_node
.
getMonitorScope
(),
'disabled'
)
self
.
assertEqual
(
compute_node
.
getMonitorScope
(),
monitor_scope
)
self
.
commit
()
compute_node
.
edit
(
allocation_scope
=
None
)
...
...
@@ -230,12 +231,12 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
self
.
commit
()
self
.
assertEqual
(
compute_node
.
getCapacityScope
(),
'close'
)
self
.
assertEqual
(
compute_node
.
getMonitorScope
(),
'disabled'
)
self
.
assertEqual
(
compute_node
.
getMonitorScope
(),
monitor_scope
)
return
compute_node
def
test_ComputeNode_setAllocationScope_closed_forever_no_source_adm
(
self
):
self
.
_test_ComputeNode_setAllocationScope_closed
()
self
.
_test_ComputeNode_setAllocationScope_closed
(
monitor_scope
=
'disabled'
)
def
test_ComputeNode_setAllocationScope_closed_forever_with_source_adm
(
self
):
person
=
self
.
makePerson
()
...
...
@@ -243,7 +244,7 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
self
.
assertNotIn
(
person
.
getDefaultEmailCoordinateText
(),
[
None
,
""
])
compute_node
=
self
.
_test_ComputeNode_setAllocationScope_closed
(
source_administration
=
person
.
getRelativeUrl
())
source_administration
=
person
.
getRelativeUrl
()
,
monitor_scope
=
'disabled'
)
self
.
assertEqual
(
compute_node
.
getSubjectList
(),
[
person
.
getDefaultEmailCoordinateText
()])
self
.
assertEqual
(
compute_node
.
getDestinationSectionList
(),
...
...
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/slapos_erp5_interaction_workflow/script_ComputeNode_updateAllocation.py
View file @
0f7c72df
...
...
@@ -3,18 +3,17 @@ allocation_scope = compute_node.getAllocationScope()
edit_kw
=
{}
if
compute_node
.
getCapacityScope
()
is
None
:
# Automatically close the capacity whenever the allocation scope
# changes, and let the alarm update it later, whenever the
# allocation scope is open.
if
compute_node
.
getCapacityScope
()
!=
"close"
:
edit_kw
[
'capacity_scope'
]
=
'close'
if
allocation_scope
in
[
'open/public'
,
'open/subscription'
,
'open/friend'
]:
monitor_scope
=
'enabled'
elif
allocation_scope
==
'open/personal'
:
monitor_scope
=
compute_node
.
getMonitorScope
(
"disabled"
)
else
:
monitor_scope
=
'disabled'
edit_kw
[
'capacity_scope'
]
=
'close'
if
compute_node
.
getMonitorScope
()
is
None
:
edit_kw
[
'monitor_scope'
]
=
'enabled'
edit_kw
[
'monitor_scope'
]
=
monitor_scope
if
allocation_scope
==
"close/forever"
:
edit_kw
[
'monitor_scope'
]
=
'disabled'
self_person
=
compute_node
.
getSourceAdministrationValue
(
portal_type
=
"Person"
)
if
self_person
is
None
:
...
...
master/bt5/slapos_jio/ActionTemplateItem/portal_types/Compute%20Node/update_allocation_scope.xml
deleted
100644 → 0
View file @
06a27d31
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ActionInformation"
module=
"Products.CMFCore.ActionInformation"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
action_type/object_jio_action
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
category
</string>
</key>
<value>
<string>
object_jio_action
</string>
</value>
</item>
<item>
<key>
<string>
condition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
icon
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
update_allocation_scope
</string>
</value>
</item>
<item>
<key>
<string>
permissions
</string>
</key>
<value>
<tuple>
<string>
View
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Action Information
</string>
</value>
</item>
<item>
<key>
<string>
priority
</string>
</key>
<value>
<float>
0.8
</float>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Update Allocation Scope
</string>
</value>
</item>
<item>
<key>
<string>
visible
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Expression"
module=
"Products.CMFCore.Expression"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
text
</string>
</key>
<value>
<string>
string:${object_url}/ComputeNode_viewAllocationScopeUpdateDialog
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio/ActionTemplateItem/portal_types/Compute%20Node/update_category.xml
deleted
100644 → 0
View file @
06a27d31
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ActionInformation"
module=
"Products.CMFCore.ActionInformation"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
action_type/object_jio_action
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
category
</string>
</key>
<value>
<string>
object_jio_action
</string>
</value>
</item>
<item>
<key>
<string>
condition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
icon
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
update_category
</string>
</value>
</item>
<item>
<key>
<string>
permissions
</string>
</key>
<value>
<tuple>
<string>
View
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Action Information
</string>
</value>
</item>
<item>
<key>
<string>
priority
</string>
</key>
<value>
<float>
0.81
</float>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Update Compute Node Categories
</string>
</value>
</item>
<item>
<key>
<string>
visible
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Expression"
module=
"Products.CMFCore.Expression"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
text
</string>
</key>
<value>
<string>
string:${object_url}/ComputeNode_viewCategoryAsWeb
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio/bt/template_action_path_list
View file @
0f7c72df
...
...
@@ -6,8 +6,6 @@ Compute Node | new_ticket
Compute Node | request_certificate_action
Compute Node | revoke_certificate
Compute Node | slaposjs_view
Compute Node | update_allocation_scope
Compute Node | update_category
Computer Network Module | slaposjs_view
Computer Network | slaposjs_view
ERP5 Login | slaposjs_view
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_ComputeNodeCheckUpgradeSoftwareRelease.py
View file @
0f7c72df
portal
=
context
.
getPortalObject
()
default_allocation_scope_uid
=
[
category
.
getUid
()
\
for
category
in
portal
.
portal_categories
.
allocation_scope
.
open
.
objectValues
()]
default_upgrade_scope_uid
=
[
portal
.
portal_categories
.
upgrade_scope
.
auto
.
getUid
(),
portal
.
portal_categories
.
upgrade_scope
.
confirmation
.
getUid
()
]
if
default_allocation_scope_uid
:
if
default_upgrade_scope_uid
:
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Compute Node'
,
validation_state
=
'validated'
,
default_
allocation_scope_uid
=
default_allocation
_scope_uid
,
default_
upgrade_scope_uid
=
default_upgrade
_scope_uid
,
method_id
=
'ComputeNode_checkAndCreateUpgradeDecision'
,
activate_kw
=
{
'tag'
:
tag
}
)
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/InstanceTree_createUpgradeDecision.py
View file @
0f7c72df
...
...
@@ -40,9 +40,6 @@ if slave_upgrade:
if
url_string
!=
instance_tree
.
getUrlString
():
newer_release
=
context
.
portal_catalog
.
getResultValue
(
portal_type
=
'Software Release'
,
url_string
=
url_string
)
else
:
if
not
partition
.
getParentValue
().
getAllocationScopeUid
()
in
[
category
.
getUid
()
\
for
category
in
portal
.
portal_categories
.
allocation_scope
.
open
.
objectValues
()]:
return
newer_release
=
instance_tree
.
\
InstanceTree_getUpgradableSoftwareRelease
()
if
newer_release
is
None
:
...
...
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMAlarm.py
View file @
0f7c72df
This diff is collapsed.
Click to expand it.
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMAlarm.xml
View file @
0f7c72df
...
...
@@ -6,12 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSPDMAlarm
</string>
</value>
...
...
@@ -55,28 +49,13 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -89,7 +68,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -98,7 +77,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.py
View file @
0f7c72df
...
...
@@ -219,7 +219,15 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
self
.
tic
()
up_decision
=
instance_tree
.
InstanceTree_createUpgradeDecision
()
self
.
assertEqual
(
up_decision
,
None
)
self
.
assertNotEqual
(
up_decision
,
None
)
self
.
assertEqual
(
up_decision
.
getSimulationState
(),
'planned'
)
self
.
assertEqual
(
up_decision
.
UpgradeDecision_getAggregateValue
(
"Instance Tree"
).
\
getReference
(),
instance_tree
.
getReference
())
self
.
assertEqual
(
software_release2
.
getUrlString
(),
up_decision
.
UpgradeDecision_getAggregateValue
(
"Software Release"
).
\
getUrlString
())
def
testInstanceTree_createUpgradeDecision_create_once_transaction
(
self
):
person
=
self
.
_makePerson
()
...
...
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMCreateUpgradeDecisionSkins.xml
View file @
0f7c72df
...
...
@@ -6,12 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSPDMCreateUpgradeDecisionSkins
</string>
</value>
...
...
@@ -55,28 +49,13 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -89,7 +68,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -98,7 +77,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
master/bt5/slapos_pdm/WorkflowTemplateItem/portal_workflow/upgrade_slap_interface_workflow/script_UpgradeDecision_reviewUpgrade.py
View file @
0f7c72df
...
...
@@ -31,11 +31,11 @@ if instance_tree is not None:
compute_node
=
upgrade_decision
.
UpgradeDecision_getAggregateValue
(
"Compute Node"
)
if
compute_node
is
not
None
:
if
compute_node
.
getUpgradeScope
()
in
[
'never'
,
'disabled'
]:
upgrade_decision
.
cancel
(
"Upgrade scope was disabled on the related
Instance Tre
e"
)
upgrade_decision
.
cancel
(
"Upgrade scope was disabled on the related
Compute Nod
e"
)
return
elif
compute_node
.
getAllocationScope
()
in
[
"closed/forever"
,
"closed/termination"
]
:
upgrade_decision
.
cancel
(
comment
=
"Compute Node is close
d
."
)
elif
compute_node
.
getAllocationScope
()
==
"close/forever"
:
upgrade_decision
.
cancel
(
comment
=
"Compute Node is close
forever
."
)
return
already_deployed
=
len
(
portal
.
portal_catalog
(
limit
=
1
,
...
...
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