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
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
46669d4b
Commit
46669d4b
authored
Oct 05, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: Do not allow user to change the release/type/shared status
parent
05d37c93
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
26 deletions
+30
-26
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudPersonSlapInterfaceWorkflow.py
...s/test.erp5.testSlapOSCloudPersonSlapInterfaceWorkflow.py
+22
-25
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestSoftwareInstance.py
...terface_workflow/script_Person_requestSoftwareInstance.py
+8
-1
No files found.
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudPersonSlapInterfaceWorkflow.py
View file @
46669d4b
...
...
@@ -20,7 +20,6 @@
##############################################################################
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
import
transaction
from
unittest
import
expectedFailure
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
setSecurityManager
...
...
@@ -326,7 +325,6 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
project_reference
=
self
.
project
.
getReference
()
)
@
expectedFailure
def
test_Person_requestSoftwareInstance_updateInstanceTree
(
self
):
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
...
...
@@ -352,7 +350,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
project_reference
=
self
.
project
.
getReference
()
)
instance_tree
=
person
.
REQUEST
.
get
(
'request_instance_tree'
)
instance_tree_reference
=
instance_tree
.
getReference
()
#
instance_tree_reference = instance_tree.getReference()
transaction
.
commit
()
self
.
tic
()
...
...
@@ -370,31 +368,30 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
shared2
=
False
state2
=
"stopped"
person
.
requestSoftwareInstance
(
software_release
=
software_release2
,
software_title
=
software_title
,
software_type
=
software_type2
,
instance_xml
=
instance_xml2
,
sla_xml
=
sla_xml2
,
shared
=
shared2
,
state
=
state2
,
project_reference
=
self
.
project
.
getReference
()
)
instance_tree2
=
person
.
REQUEST
.
get
(
'request_instance_tree'
)
self
.
assertEqual
(
instance_tree
.
getRelativeUrl
(),
instance_tree2
.
getRelativeUrl
())
self
.
assertEqual
(
instance_tree_reference
,
instance_tree2
.
getReference
())
try
:
person
.
requestSoftwareInstance
(
software_release
=
software_release2
,
software_title
=
software_title
,
software_type
=
software_type2
,
instance_xml
=
instance_xml2
,
sla_xml
=
sla_xml2
,
shared
=
shared2
,
state
=
state2
,
project_reference
=
self
.
project
.
getReference
()
)
except
NotImplementedError
:
pass
else
:
raise
AssertionError
(
'User is not supposed to change the release/type/shared'
)
self
.
assertEqual
(
software_release
2
,
self
.
assertEqual
(
software_release
,
instance_tree
.
getUrlString
())
self
.
assertEqual
(
software_title
,
instance_tree
.
getTitle
())
self
.
assertEqual
(
software_type
2
,
instance_tree
.
getSourceReference
())
self
.
assertEqual
(
instance_xml
2
,
instance_tree
.
getTextContent
())
self
.
assertEqual
(
sla_xml
2
,
instance_tree
.
getSlaXml
())
self
.
assertEqual
(
shared
2
,
instance_tree
.
getRootSlave
())
self
.
assertEqual
(
"st
op
_requested"
,
instance_tree
.
getSlapState
())
self
.
assertEqual
(
software_type
,
instance_tree
.
getSourceReference
())
self
.
assertEqual
(
instance_xml
,
instance_tree
.
getTextContent
())
self
.
assertEqual
(
sla_xml
,
instance_tree
.
getSlaXml
())
self
.
assertEqual
(
shared
,
instance_tree
.
getRootSlave
())
self
.
assertEqual
(
"st
art
_requested"
,
instance_tree
.
getSlapState
())
self
.
assertEqual
(
"validated"
,
instance_tree
.
getValidationState
())
def
test_Person_requestSoftwareInstance_duplicatedInstanceTree
(
self
):
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestSoftwareInstance.py
View file @
46669d4b
...
...
@@ -42,7 +42,7 @@ request_instance_tree_list = portal.portal_catalog(
portal_type
=
instance_tree_portal_type
,
title
=
{
'query'
:
software_title
,
'key'
:
'ExactMatch'
},
validation_state
=
"validated"
,
de
fault_destination_section
_uid
=
person
.
getUid
(),
de
stination_section_
_uid
=
person
.
getUid
(),
limit
=
2
,
)
if
len
(
request_instance_tree_list
)
>
1
:
...
...
@@ -55,6 +55,13 @@ elif len(request_instance_tree_list) == 1:
(
request_instance_tree
.
getValidationState
()
!=
"validated"
)
or
\
(
request_instance_tree
.
getDestinationSection
()
!=
person
.
getRelativeUrl
()):
raise
NotImplementedError
,
"The system was not able to get the expected instance tree"
# Do not allow user to change the release/type/shared status
# This is not compatible with invoicing the service
# Instance release change will be handled by allocation supply and upgrade decision
if
(
request_instance_tree
.
getUrlString
()
!=
software_release_url_string
)
or
\
(
request_instance_tree
.
getSourceReference
()
!=
software_type
)
or
\
(
request_instance_tree
.
getRootSlave
()
!=
is_slave
):
raise
NotImplementedError
,
"You can not change the release / type / shared states"
else
:
if
(
root_state
==
"destroyed"
):
# No need to create destroyed subscription.
...
...
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