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
Carlos Ramos Carreño
slapos.core
Commits
de958007
Commit
de958007
authored
Sep 12, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: fixup Unauthorized error when stopping/destroying a slave instance
parent
4fd22597
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
19 deletions
+43
-19
master/bt5/slapos_cloud/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSCloud.py
...plateItem/portal_components/extension.erp5.SlapOSCloud.py
+2
-2
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_bangIfStateChangeToDestroyed.py
.../script_RequestedInstance_bangIfStateChangeToDestroyed.py
+6
-2
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_bangIfStateChangeToDestroyed.xml
...script_RequestedInstance_bangIfStateChangeToDestroyed.xml
+8
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_bangIfStateChangeToStopped.py
...ow/script_RequestedInstance_bangIfStateChangeToStopped.py
+6
-2
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_bangIfStateChangeToStopped.xml
...w/script_RequestedInstance_bangIfStateChangeToStopped.xml
+8
-0
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterScenario.py
...mponents/test.erp5.testSlapOSERP5VirtualMasterScenario.py
+13
-13
No files found.
master/bt5/slapos_cloud/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSCloud.py
View file @
de958007
...
...
@@ -54,7 +54,7 @@ def cloneDocumentWithANewPortalType(obj, portal_type):
def
SoftwareInstance_bangAsSelf
(
self
,
relative_url
=
None
,
reference
=
None
,
comment
=
None
):
bang_tree
=
True
,
comment
=
None
):
"""Call bang on self."""
# Caller check
if
relative_url
is
None
:
...
...
@@ -72,7 +72,7 @@ def SoftwareInstance_bangAsSelf(self, relative_url=None, reference=None,
sm
=
getSecurityManager
()
try
:
newSecurityManager
(
None
,
user
)
software_instance
.
bang
(
bang_tree
=
Tru
e
,
comment
=
comment
)
software_instance
.
bang
(
bang_tree
=
bang_tre
e
,
comment
=
comment
)
finally
:
setSecurityManager
(
sm
)
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_bangIfStateChangeToDestroyed.py
View file @
de958007
...
...
@@ -12,5 +12,9 @@ if instance.getSlapState() != 'destroy_requested':
if
partition
is
not
None
:
software_instance
=
partition
.
getAggregateRelatedValue
(
portal_type
=
"Software Instance"
)
if
software_instance
is
not
None
:
software_instance
.
bang
(
bang_tree
=
False
,
comment
=
"State changed from %s (shared) to destroy_requested"
%
instance
.
getSlapState
())
software_instance
.
SoftwareInstance_bangAsSelf
(
relative_url
=
software_instance
.
getRelativeUrl
(),
reference
=
software_instance
.
getReference
(),
bang_tree
=
False
,
comment
=
"State changed from %s (shared) to destroy_requested"
%
instance
.
getSlapState
()
)
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_bangIfStateChangeToDestroyed.xml
View file @
de958007
...
...
@@ -52,6 +52,14 @@
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_bangIfStateChangeToStopped.py
View file @
de958007
...
...
@@ -12,5 +12,9 @@ if instance.getSlapState() != 'stop_requested':
if
partition
is
not
None
:
software_instance
=
partition
.
getAggregateRelatedValue
(
portal_type
=
"Software Instance"
)
if
software_instance
is
not
None
:
software_instance
.
bang
(
bang_tree
=
False
,
comment
=
"State changed from %s (shared) to stop_requested"
%
instance
.
getSlapState
())
software_instance
.
SoftwareInstance_bangAsSelf
(
relative_url
=
software_instance
.
getRelativeUrl
(),
reference
=
software_instance
.
getReference
(),
bang_tree
=
False
,
comment
=
"State changed from %s (shared) to stop_requested"
%
instance
.
getSlapState
()
)
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_bangIfStateChangeToStopped.xml
View file @
de958007
...
...
@@ -52,6 +52,14 @@
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
...
...
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterScenario.py
View file @
de958007
...
...
@@ -1110,10 +1110,16 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
public_reference
=
'public-%s'
%
self
.
generateNewId
()
self
.
joinSlapOS
(
self
.
web_site
,
public_reference
)
shared_public_reference
=
'shared_public-%s'
%
self
.
generateNewId
()
self
.
joinSlapOS
(
self
.
web_site
,
shared_public_reference
)
self
.
login
()
public_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"ERP5 Login"
,
reference
=
public_reference
).
getParentValue
()
shared_public_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"ERP5 Login"
,
reference
=
shared_public_reference
).
getParentValue
()
with
PinnedDateTime
(
self
,
DateTime
(
'2024/02/17 00:05'
)):
public_instance_title
=
'Public title %s'
%
self
.
generateNewId
()
...
...
@@ -1140,24 +1146,18 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
software_release
,
software_type
)
self
.
login
()
public_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"ERP5 Login"
,
reference
=
public_reference
).
getParentValue
()
slave_instance_title
=
'Slave title %s'
%
self
.
generateNewId
()
self
.
checkSlaveInstanceAllocation
(
public_person
.
getUserId
(),
public_reference
,
slave_instance_title
,
self
.
checkSlaveInstanceAllocation
(
shared_
public_person
.
getUserId
(),
shared_
public_reference
,
slave_instance_title
,
slave_server_software
,
slave_instance_type
,
public_server
,
project
.
getReference
())
self
.
login
()
public_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'ERP5 Login'
,
reference
=
public_reference
).
getParentValue
()
self
.
login
(
owner_person
.
getUserId
())
# and the instances
self
.
checkSlaveInstanceUnallocation
(
public_person
.
getUserId
(),
public_reference
,
slave_instance_title
,
self
.
checkSlaveInstanceUnallocation
(
shared_
public_person
.
getUserId
(),
shared_
public_reference
,
slave_instance_title
,
slave_server_software
,
slave_instance_type
,
public_server
,
project
.
getReference
())
...
...
@@ -1178,10 +1178,10 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
# Ensure no unexpected object has been created
# 6 allocation supply/line/cell
# 2 compute/instance node
#
1
credential request
#
2
credential request
# 2 instance tree
# 9 open sale order / line
#
3
assignment
#
4
assignment
# 4 simulation movement
# 4 sale packing list
# 2 sale trade condition
...
...
@@ -1189,7 +1189,7 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
# 2 software instance
# 2 software product
# 4 subscription request
self
.
assertRelatedObjectCount
(
project
,
4
2
)
self
.
assertRelatedObjectCount
(
project
,
4
4
)
self
.
checkERP5StateBeforeExit
()
...
...
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