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
17
Merge Requests
17
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
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
Pipeline
#36776
failed with stage
in 0 seconds
Changes
6
Pipelines
1
Hide 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):
...
@@ -54,7 +54,7 @@ def cloneDocumentWithANewPortalType(obj, portal_type):
def
SoftwareInstance_bangAsSelf
(
self
,
relative_url
=
None
,
reference
=
None
,
def
SoftwareInstance_bangAsSelf
(
self
,
relative_url
=
None
,
reference
=
None
,
comment
=
None
):
bang_tree
=
True
,
comment
=
None
):
"""Call bang on self."""
"""Call bang on self."""
# Caller check
# Caller check
if
relative_url
is
None
:
if
relative_url
is
None
:
...
@@ -72,7 +72,7 @@ def SoftwareInstance_bangAsSelf(self, relative_url=None, reference=None,
...
@@ -72,7 +72,7 @@ def SoftwareInstance_bangAsSelf(self, relative_url=None, reference=None,
sm
=
getSecurityManager
()
sm
=
getSecurityManager
()
try
:
try
:
newSecurityManager
(
None
,
user
)
newSecurityManager
(
None
,
user
)
software_instance
.
bang
(
bang_tree
=
Tru
e
,
comment
=
comment
)
software_instance
.
bang
(
bang_tree
=
bang_tre
e
,
comment
=
comment
)
finally
:
finally
:
setSecurityManager
(
sm
)
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':
...
@@ -12,5 +12,9 @@ if instance.getSlapState() != 'destroy_requested':
if
partition
is
not
None
:
if
partition
is
not
None
:
software_instance
=
partition
.
getAggregateRelatedValue
(
portal_type
=
"Software Instance"
)
software_instance
=
partition
.
getAggregateRelatedValue
(
portal_type
=
"Software Instance"
)
if
software_instance
is
not
None
:
if
software_instance
is
not
None
:
software_instance
.
bang
(
bang_tree
=
False
,
software_instance
.
SoftwareInstance_bangAsSelf
(
comment
=
"State changed from %s (shared) to destroy_requested"
%
instance
.
getSlapState
())
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 @@
...
@@ -52,6 +52,14 @@
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
</item>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<item>
<key>
<string>
description
</string>
</key>
<key>
<string>
description
</string>
</key>
<value>
<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':
...
@@ -12,5 +12,9 @@ if instance.getSlapState() != 'stop_requested':
if
partition
is
not
None
:
if
partition
is
not
None
:
software_instance
=
partition
.
getAggregateRelatedValue
(
portal_type
=
"Software Instance"
)
software_instance
=
partition
.
getAggregateRelatedValue
(
portal_type
=
"Software Instance"
)
if
software_instance
is
not
None
:
if
software_instance
is
not
None
:
software_instance
.
bang
(
bang_tree
=
False
,
software_instance
.
SoftwareInstance_bangAsSelf
(
comment
=
"State changed from %s (shared) to stop_requested"
%
instance
.
getSlapState
())
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 @@
...
@@ -52,6 +52,14 @@
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
</item>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<item>
<key>
<string>
description
</string>
</key>
<key>
<string>
description
</string>
</key>
<value>
<value>
...
...
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterScenario.py
View file @
de958007
...
@@ -1110,10 +1110,16 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
...
@@ -1110,10 +1110,16 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
public_reference
=
'public-%s'
%
self
.
generateNewId
()
public_reference
=
'public-%s'
%
self
.
generateNewId
()
self
.
joinSlapOS
(
self
.
web_site
,
public_reference
)
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
()
self
.
login
()
public_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
public_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"ERP5 Login"
,
portal_type
=
"ERP5 Login"
,
reference
=
public_reference
).
getParentValue
()
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'
)):
with
PinnedDateTime
(
self
,
DateTime
(
'2024/02/17 00:05'
)):
public_instance_title
=
'Public title %s'
%
self
.
generateNewId
()
public_instance_title
=
'Public title %s'
%
self
.
generateNewId
()
...
@@ -1140,24 +1146,18 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
...
@@ -1140,24 +1146,18 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
software_release
,
software_type
)
software_release
,
software_type
)
self
.
login
()
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
()
slave_instance_title
=
'Slave title %s'
%
self
.
generateNewId
()
self
.
checkSlaveInstanceAllocation
(
public_person
.
getUserId
(),
self
.
checkSlaveInstanceAllocation
(
shared_
public_person
.
getUserId
(),
public_reference
,
slave_instance_title
,
shared_
public_reference
,
slave_instance_title
,
slave_server_software
,
slave_instance_type
,
slave_server_software
,
slave_instance_type
,
public_server
,
project
.
getReference
())
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
())
self
.
login
(
owner_person
.
getUserId
())
# and the instances
# and the instances
self
.
checkSlaveInstanceUnallocation
(
public_person
.
getUserId
(),
self
.
checkSlaveInstanceUnallocation
(
shared_
public_person
.
getUserId
(),
public_reference
,
slave_instance_title
,
shared_
public_reference
,
slave_instance_title
,
slave_server_software
,
slave_instance_type
,
public_server
,
slave_server_software
,
slave_instance_type
,
public_server
,
project
.
getReference
())
project
.
getReference
())
...
@@ -1178,10 +1178,10 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
...
@@ -1178,10 +1178,10 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
# Ensure no unexpected object has been created
# Ensure no unexpected object has been created
# 6 allocation supply/line/cell
# 6 allocation supply/line/cell
# 2 compute/instance node
# 2 compute/instance node
#
1
credential request
#
2
credential request
# 2 instance tree
# 2 instance tree
# 9 open sale order / line
# 9 open sale order / line
#
3
assignment
#
4
assignment
# 4 simulation movement
# 4 simulation movement
# 4 sale packing list
# 4 sale packing list
# 2 sale trade condition
# 2 sale trade condition
...
@@ -1189,7 +1189,7 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
...
@@ -1189,7 +1189,7 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
# 2 software instance
# 2 software instance
# 2 software product
# 2 software product
# 4 subscription request
# 4 subscription request
self
.
assertRelatedObjectCount
(
project
,
4
2
)
self
.
assertRelatedObjectCount
(
project
,
4
4
)
self
.
checkERP5StateBeforeExit
()
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