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
Titouan Soulard
slapos.core
Commits
508d2ac6
Commit
508d2ac6
authored
Nov 24, 2021
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
Set Upgrade scope "auto" by default
See merge request
nexedi/slapos.core!345
parents
126bb776
c64a9eb3
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
32 additions
and
82 deletions
+32
-82
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/compute_node_slap_interface_workflow/script_ComputeNode_approveRegistration.py
...erface_workflow/script_ComputeNode_approveRegistration.py
+2
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/compute_node_slap_interface_workflow/script_ComputeNode_approveRegistration.xml
...rface_workflow/script_ComputeNode_approveRegistration.xml
+6
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestComputeNode.py
...ap_interface_workflow/script_Person_requestComputeNode.py
+0
-1
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestComputeNode.xml
...p_interface_workflow/script_Person_requestComputeNode.xml
+6
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestSoftwareInstance.py
...terface_workflow/script_Person_requestSoftwareInstance.py
+1
-0
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5InteractionWorkflow.py
...components/test.erp5.testSlapOSERP5InteractionWorkflow.py
+2
-65
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/slapos_erp5_interaction_workflow/script_ComputeNode_updateAllocation.py
...teraction_workflow/script_ComputeNode_updateAllocation.py
+1
-12
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/slapos_erp5_interaction_workflow/script_ComputeNode_updateAllocation.xml
...eraction_workflow/script_ComputeNode_updateAllocation.xml
+6
-0
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSPDMSkins.py
+8
-4
No files found.
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/compute_node_slap_interface_workflow/script_ComputeNode_approveRegistration.py
View file @
508d2ac6
...
...
@@ -4,6 +4,8 @@ person = portal.portal_membership.getAuthenticatedMember().getUserValue()
compute_node
.
edit
(
allocation_scope
=
'open/personal'
,
source_administration_value
=
person
,
upgrade_scope
=
'auto'
,
capacity_scope
=
'open'
)
erp5_login
=
compute_node
.
newContent
(
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/compute_node_slap_interface_workflow/script_ComputeNode_approveRegistration.xml
View file @
508d2ac6
...
...
@@ -52,6 +52,12 @@
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
script_ComputeNode_approveRegistration
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestComputeNode.py
View file @
508d2ac6
...
...
@@ -36,7 +36,6 @@ if compute_node is None:
portal_type
=
compute_node_portal_type
,
title
=
compute_node_title
,
reference
=
reference
,
capacity_scope
=
'open'
,
activate_kw
=
{
'tag'
:
tag
}
)
compute_node
.
requestComputeNodeRegistration
()
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestComputeNode.xml
View file @
508d2ac6
...
...
@@ -52,6 +52,12 @@
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
script_Person_requestComputeNode
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestSoftwareInstance.py
View file @
508d2ac6
...
...
@@ -58,6 +58,7 @@ else:
reference
=
instance_tree_reference
,
title
=
software_title
,
destination_section
=
person
.
getRelativeUrl
(),
upgrade_scope
=
"auto"
,
activate_kw
=
{
'tag'
:
tag
},
)
...
...
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5InteractionWorkflow.py
View file @
508d2ac6
...
...
@@ -24,15 +24,12 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
SlapOSTestCaseMixin
):
def
_test_ComputeNode_setAllocationScope_public
(
self
,
upgrade_scope
=
None
,
allocation_scope
=
"open/public"
,
source_administration
=
None
,
expected_upgrade_scope
=
'auto'
):
source_administration
=
None
):
compute_node
=
self
.
portal
.
compute_node_module
.
newContent
(
portal_type
=
'Compute Node'
)
compute_node
.
edit
(
capacity_scope
=
None
,
monitor_scope
=
None
,
upgrade_scope
=
upgrade_scope
,
source_administration
=
source_administration
)
self
.
commit
()
compute_node
.
edit
(
allocation_scope
=
allocation_scope
)
...
...
@@ -40,7 +37,6 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
self
.
commit
()
self
.
assertEqual
(
compute_node
.
getCapacityScope
(),
'close'
)
self
.
assertEqual
(
compute_node
.
getMonitorScope
(),
'enabled'
)
self
.
assertEqual
(
compute_node
.
getUpgradeScope
(),
expected_upgrade_scope
)
return
compute_node
def
test_ComputeNode_setAllocationScope_public_no_source_adm
(
self
):
...
...
@@ -51,27 +47,6 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
allocation_scope
=
"open/subscription"
)
def
test_ComputeNode_setAllocationScope_public_ask_confirmation
(
self
):
self
.
_test_ComputeNode_setAllocationScope_public
(
upgrade_scope
=
"ask_confirmation"
)
def
test_ComputeNode_setAllocationScope_subscription_ask_confirmation
(
self
):
self
.
_test_ComputeNode_setAllocationScope_public
(
allocation_scope
=
"open/subscription"
,
upgrade_scope
=
"ask_confirmation"
)
def
test_ComputeNode_setAllocationScope_public_upgrade_disabled
(
self
):
self
.
_test_ComputeNode_setAllocationScope_public
(
upgrade_scope
=
"disabled"
,
expected_upgrade_scope
=
"disabled"
)
def
test_ComputeNode_setAllocationScope_subscription_upgrade_disabled
(
self
):
self
.
_test_ComputeNode_setAllocationScope_public
(
allocation_scope
=
"open/subscription"
,
upgrade_scope
=
"disabled"
,
expected_upgrade_scope
=
"disabled"
)
def
test_ComputeNode_setAllocationScope_public_with_source_adm
(
self
):
person
=
self
.
makePerson
()
self
.
assertNotIn
(
person
.
getDefaultEmailCoordinateText
(),
[
None
,
""
])
...
...
@@ -95,13 +70,11 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
def
_test_ComputeNode_setAllocationScope_personal
(
self
,
upgrade_scope
=
None
,
source_administration
=
None
,
subject_list
=
None
):
compute_node
=
self
.
portal
.
compute_node_module
.
newContent
(
portal_type
=
'Compute Node'
,
capacity_scope
=
None
,
monitor_scope
=
None
,
upgrade_scope
=
upgrade_scope
,
source_administration
=
source_administration
)
if
subject_list
:
compute_node
.
setSubjectList
(
subject_list
)
...
...
@@ -115,21 +88,6 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
def
test_ComputeNode_setAllocationScope_personal
(
self
):
compute_node
=
self
.
_test_ComputeNode_setAllocationScope_personal
()
self
.
assertEqual
(
compute_node
.
getUpgradeScope
(),
'ask_confirmation'
)
self
.
assertEqual
(
compute_node
.
getSubjectList
(),
[])
self
.
assertEqual
(
compute_node
.
getDestinationSection
(),
None
)
def
test_ComputeNode_setAllocationScope_personal_upgrade_disabled
(
self
):
compute_node
=
self
.
_test_ComputeNode_setAllocationScope_personal
(
upgrade_scope
=
"disabled"
)
self
.
assertEqual
(
compute_node
.
getUpgradeScope
(),
'disabled'
)
self
.
assertEqual
(
compute_node
.
getSubjectList
(),
[])
self
.
assertEqual
(
compute_node
.
getDestinationSection
(),
None
)
def
test_ComputeNode_setAllocationScope_personal_upgrade_auto
(
self
):
compute_node
=
self
.
_test_ComputeNode_setAllocationScope_personal
(
upgrade_scope
=
"auto"
)
self
.
assertEqual
(
compute_node
.
getUpgradeScope
(),
'auto'
)
self
.
assertEqual
(
compute_node
.
getSubjectList
(),
[])
self
.
assertEqual
(
compute_node
.
getDestinationSection
(),
None
)
...
...
@@ -141,7 +99,6 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
compute_node
=
self
.
_test_ComputeNode_setAllocationScope_personal
(
source_administration
=
person
.
getRelativeUrl
(),
)
self
.
assertEqual
(
compute_node
.
getUpgradeScope
(),
'ask_confirmation'
)
self
.
assertEqual
(
compute_node
.
getSubjectList
(),
[
person
.
getDefaultEmailCoordinateText
()])
self
.
assertEqual
(
compute_node
.
getDestinationSectionList
(),
[
person
.
getRelativeUrl
()])
...
...
@@ -155,21 +112,17 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
source_administration
=
person
.
getRelativeUrl
(),
subject_list
=
[
"some@example.com"
]
)
self
.
assertEqual
(
compute_node
.
getUpgradeScope
(),
'ask_confirmation'
)
self
.
assertEqual
(
compute_node
.
getSubjectList
(),
[
person
.
getDefaultEmailCoordinateText
()])
self
.
assertEqual
(
compute_node
.
getDestinationSectionList
(),
[
person
.
getRelativeUrl
()])
def
_test_ComputeNode_setAllocationScope_friend
(
self
,
upgrade_scope
=
None
,
source_administration
=
None
,
subject_list
=
None
,
expected_upgrade_scope
=
'auto'
):
subject_list
=
None
):
compute_node
=
self
.
portal
.
compute_node_module
.
newContent
(
portal_type
=
'Compute Node'
)
compute_node
.
edit
(
capacity_scope
=
None
,
monitor_scope
=
None
,
upgrade_scope
=
upgrade_scope
,
source_administration
=
source_administration
)
if
subject_list
:
...
...
@@ -181,21 +134,8 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
self
.
commit
()
self
.
assertEqual
(
compute_node
.
getCapacityScope
(),
'open'
)
self
.
assertEqual
(
compute_node
.
getMonitorScope
(),
'enabled'
)
self
.
assertEqual
(
compute_node
.
getUpgradeScope
(),
expected_upgrade_scope
)
return
compute_node
def
test_ComputeNode_setAllocationScope_friend_no_source_adm
(
self
):
self
.
_test_ComputeNode_setAllocationScope_friend
()
def
test_ComputeNode_setAllocationScope_friend_ask_confirmation
(
self
):
self
.
_test_ComputeNode_setAllocationScope_friend
(
upgrade_scope
=
"ask_confirmation"
)
def
test_ComputeNode_setAllocationScope_friend_upgrade_disabled
(
self
):
self
.
_test_ComputeNode_setAllocationScope_friend
(
upgrade_scope
=
"disabled"
,
expected_upgrade_scope
=
"disabled"
)
def
test_ComputeNode_setAllocationScope_friend_with_source_adm
(
self
):
person
=
self
.
makePerson
()
self
.
tic
()
...
...
@@ -226,14 +166,12 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
def
_test_ComputeNode_setAllocationScope_closed
(
self
,
upgrade_scope
=
None
,
source_administration
=
None
,
allocation_scope
=
"close/forever"
,
subject_list
=
None
):
compute_node
=
self
.
portal
.
compute_node_module
.
newContent
(
portal_type
=
'Compute Node'
,
capacity_scope
=
None
,
monitor_scope
=
None
,
upgrade_scope
=
upgrade_scope
,
source_administration
=
source_administration
)
if
subject_list
:
compute_node
.
setSubjectList
(
subject_list
)
...
...
@@ -243,7 +181,6 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
self
.
commit
()
self
.
assertEqual
(
compute_node
.
getCapacityScope
(),
'close'
)
self
.
assertEqual
(
compute_node
.
getMonitorScope
(),
'disabled'
)
self
.
assertEqual
(
compute_node
.
getUpgradeScope
(),
upgrade_scope
)
return
compute_node
...
...
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/slapos_erp5_interaction_workflow/script_ComputeNode_updateAllocation.py
View file @
508d2ac6
compute_node
=
state_object
[
"object"
]
allocation_scope
=
compute_node
.
getAllocationScope
()
upgrade_scope
=
compute_node
.
getUpgradeScope
()
if
allocation_scope
in
[
'open/public'
,
'open/subscription'
]:
# Public compute_node capacity is handle by an alarm
capacity_scope
=
'close'
monitor_scope
=
'enabled'
if
upgrade_scope
in
[
None
,
'ask_confirmation'
]:
upgrade_scope
=
'auto'
elif
allocation_scope
==
'open/friend'
:
# Capacity is not handled for 'private' compute_nodes
capacity_scope
=
'open'
monitor_scope
=
'enabled'
if
upgrade_scope
in
[
None
,
'ask_confirmation'
]:
upgrade_scope
=
'auto'
elif
allocation_scope
==
'open/personal'
:
capacity_scope
=
'open'
# Keep the same.
monitor_scope
=
compute_node
.
getMonitorScope
(
"disabled"
)
if
upgrade_scope
is
None
:
upgrade_scope
=
'ask_confirmation'
else
:
monitor_scope
=
'disabled'
capacity_scope
=
'close'
edit_kw
=
{
'capacity_scope'
:
capacity_scope
,
'monitor_scope'
:
monitor_scope
,
'upgrade_scope'
:
upgrade_scope
'monitor_scope'
:
monitor_scope
}
self_person
=
compute_node
.
getSourceAdministrationValue
(
portal_type
=
"Person"
)
...
...
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/slapos_erp5_interaction_workflow/script_ComputeNode_updateAllocation.xml
View file @
508d2ac6
...
...
@@ -52,6 +52,12 @@
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_object
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
script_ComputeNode_updateAllocation
</string>
</value>
...
...
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMSkins.py
View file @
508d2ac6
...
...
@@ -941,10 +941,11 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
self
.
assertEqual
(
upgrade_decision
.
UpgradeDecision_tryToCancel
(
url2
),
True
)
self
.
assertEqual
(
upgrade_decision
.
getSimulationState
(),
'rejected'
)
def
testComputeNode_checkAndCreateUpgradeDecision
(
self
):
def
testComputeNode_checkAndCreateUpgradeDecision
_auto
(
self
):
person
=
self
.
_makePerson
()
compute_node
,
_
=
self
.
_makeComputeNode
(
owner
=
person
,
allocation_scope
=
"open/public"
)
compute_node
.
edit
(
upgrade_scope
=
"auto"
)
software_product
=
self
.
_makeSoftwareProduct
()
software_release
=
self
.
_requestSoftwareRelease
(
software_product
.
getRelativeUrl
())
...
...
@@ -975,9 +976,11 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
upgrade_decision2
=
compute_node
.
ComputeNode_checkAndCreateUpgradeDecision
()
self
.
assertEqual
(
len
(
upgrade_decision2
),
0
)
def
testComputeNode_checkAndCreateUpgradeDecision_
personal
_with_exist
(
self
):
def
testComputeNode_checkAndCreateUpgradeDecision_
ask_confirmation
_with_exist
(
self
):
person
=
self
.
_makePerson
()
compute_node
,
_
=
self
.
_makeComputeNode
(
owner
=
person
,
allocation_scope
=
"open/personal"
)
compute_node
,
_
=
self
.
_makeComputeNode
(
owner
=
person
,
allocation_scope
=
"open/personal"
)
compute_node
.
edit
(
upgrade_scope
=
"ask_confirmation"
)
software_product
=
self
.
_makeSoftwareProduct
()
software_release
=
self
.
_requestSoftwareRelease
(
software_product
.
getRelativeUrl
())
...
...
@@ -1002,10 +1005,11 @@ class TestSlapOSPDMSkins(TestSlapOSPDMMixinSkins):
self
.
assertEqual
(
release
.
getUrlString
(),
software_release3
.
getUrlString
())
def
testComputeNode_checkAndCreateUpgradeDecision_
public
_with_exist
(
self
):
def
testComputeNode_checkAndCreateUpgradeDecision_
auto
_with_exist
(
self
):
person
=
self
.
_makePerson
()
compute_node
,
_
=
self
.
_makeComputeNode
(
owner
=
person
,
allocation_scope
=
"open/public"
)
compute_node
.
edit
(
upgrade_scope
=
"auto"
)
software_product
=
self
.
_makeSoftwareProduct
()
software_release
=
self
.
_requestSoftwareRelease
(
software_product
.
getRelativeUrl
())
...
...
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