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
Show 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 @@
...
@@ -20,7 +20,6 @@
##############################################################################
##############################################################################
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
import
transaction
import
transaction
from
unittest
import
expectedFailure
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
setSecurityManager
setSecurityManager
...
@@ -326,7 +325,6 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
...
@@ -326,7 +325,6 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
project_reference
=
self
.
project
.
getReference
()
project_reference
=
self
.
project
.
getReference
()
)
)
@
expectedFailure
def
test_Person_requestSoftwareInstance_updateInstanceTree
(
self
):
def
test_Person_requestSoftwareInstance_updateInstanceTree
(
self
):
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
person
=
self
.
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
...
@@ -352,7 +350,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
...
@@ -352,7 +350,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
project_reference
=
self
.
project
.
getReference
()
project_reference
=
self
.
project
.
getReference
()
)
)
instance_tree
=
person
.
REQUEST
.
get
(
'request_instance_tree'
)
instance_tree
=
person
.
REQUEST
.
get
(
'request_instance_tree'
)
instance_tree_reference
=
instance_tree
.
getReference
()
#
instance_tree_reference = instance_tree.getReference()
transaction
.
commit
()
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
...
@@ -370,6 +368,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
...
@@ -370,6 +368,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
shared2
=
False
shared2
=
False
state2
=
"stopped"
state2
=
"stopped"
try
:
person
.
requestSoftwareInstance
(
person
.
requestSoftwareInstance
(
software_release
=
software_release2
,
software_release
=
software_release2
,
software_title
=
software_title
,
software_title
=
software_title
,
...
@@ -380,21 +379,19 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
...
@@ -380,21 +379,19 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
state
=
state2
,
state
=
state2
,
project_reference
=
self
.
project
.
getReference
()
project_reference
=
self
.
project
.
getReference
()
)
)
except
NotImplementedError
:
pass
else
:
raise
AssertionError
(
'User is not supposed to change the release/type/shared'
)
instance_tree2
=
person
.
REQUEST
.
get
(
'request_instance_tree'
)
self
.
assertEqual
(
software_release
,
self
.
assertEqual
(
instance_tree
.
getRelativeUrl
(),
instance_tree2
.
getRelativeUrl
())
self
.
assertEqual
(
instance_tree_reference
,
instance_tree2
.
getReference
())
self
.
assertEqual
(
software_release2
,
instance_tree
.
getUrlString
())
instance_tree
.
getUrlString
())
self
.
assertEqual
(
software_title
,
instance_tree
.
getTitle
())
self
.
assertEqual
(
software_title
,
instance_tree
.
getTitle
())
self
.
assertEqual
(
software_type
2
,
instance_tree
.
getSourceReference
())
self
.
assertEqual
(
software_type
,
instance_tree
.
getSourceReference
())
self
.
assertEqual
(
instance_xml
2
,
instance_tree
.
getTextContent
())
self
.
assertEqual
(
instance_xml
,
instance_tree
.
getTextContent
())
self
.
assertEqual
(
sla_xml
2
,
instance_tree
.
getSlaXml
())
self
.
assertEqual
(
sla_xml
,
instance_tree
.
getSlaXml
())
self
.
assertEqual
(
shared
2
,
instance_tree
.
getRootSlave
())
self
.
assertEqual
(
shared
,
instance_tree
.
getRootSlave
())
self
.
assertEqual
(
"st
op
_requested"
,
instance_tree
.
getSlapState
())
self
.
assertEqual
(
"st
art
_requested"
,
instance_tree
.
getSlapState
())
self
.
assertEqual
(
"validated"
,
instance_tree
.
getValidationState
())
self
.
assertEqual
(
"validated"
,
instance_tree
.
getValidationState
())
def
test_Person_requestSoftwareInstance_duplicatedInstanceTree
(
self
):
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(
...
@@ -42,7 +42,7 @@ request_instance_tree_list = portal.portal_catalog(
portal_type
=
instance_tree_portal_type
,
portal_type
=
instance_tree_portal_type
,
title
=
{
'query'
:
software_title
,
'key'
:
'ExactMatch'
},
title
=
{
'query'
:
software_title
,
'key'
:
'ExactMatch'
},
validation_state
=
"validated"
,
validation_state
=
"validated"
,
de
fault_destination_section
_uid
=
person
.
getUid
(),
de
stination_section_
_uid
=
person
.
getUid
(),
limit
=
2
,
limit
=
2
,
)
)
if
len
(
request_instance_tree_list
)
>
1
:
if
len
(
request_instance_tree_list
)
>
1
:
...
@@ -55,6 +55,13 @@ elif 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
.
getValidationState
()
!=
"validated"
)
or
\
(
request_instance_tree
.
getDestinationSection
()
!=
person
.
getRelativeUrl
()):
(
request_instance_tree
.
getDestinationSection
()
!=
person
.
getRelativeUrl
()):
raise
NotImplementedError
,
"The system was not able to get the expected instance tree"
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
:
else
:
if
(
root_state
==
"destroyed"
):
if
(
root_state
==
"destroyed"
):
# No need to create destroyed subscription.
# 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