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
Lu Xu
slapos.core
Commits
f55a00e8
Commit
f55a00e8
authored
Nov 14, 2023
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: Propagate activate_kw when edit
and don't exclude/add successor if nothing changed
parent
06c91260
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
10 deletions
+22
-10
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequesterInstance_request.py
...ap_interface_workflow/script_RequesterInstance_request.py
+22
-10
No files found.
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequesterInstance_request.py
View file @
f55a00e8
...
...
@@ -74,6 +74,7 @@ if (request_software_instance is None):
else
:
instance_found
=
True
# First time that the software instance is requested
successor
=
None
# Create a new one
reference
=
"SOFTINST-%s"
%
portal
.
portal_ids
.
generateNewId
(
...
...
@@ -105,8 +106,8 @@ else:
successor
=
request_software_instance
.
getSuccessorRelatedValue
(
portal_type
=
"Software Instance"
)
if
(
successor
is
None
):
# Check if the precessor is a Instance Tree
instance_tree_
precesse
sor
=
request_software_instance
.
getSuccessorRelatedValue
(
portal_type
=
"Instance Tree"
)
if
(
requester_instance
.
getPortalType
()
!=
"Instance Tree"
and
instance_tree_
precesse
sor
is
not
None
):
instance_tree_
succes
sor
=
request_software_instance
.
getSuccessorRelatedValue
(
portal_type
=
"Instance Tree"
)
if
(
requester_instance
.
getPortalType
()
!=
"Instance Tree"
and
instance_tree_
succes
sor
is
not
None
):
raise
ValueError
(
'It is disallowed to request root software instance %s'
%
request_software_instance
.
getRelativeUrl
())
else
:
successor
=
requester_instance
...
...
@@ -115,9 +116,13 @@ else:
graph
[
request_software_instance
.
getUid
()]
=
request_software_instance
.
getSuccessorUidList
()
successor_uid_list
=
successor
.
getSuccessorUidList
()
if
successor
!=
requester_instance
:
if
request_software_instance
.
getUid
()
in
successor_uid_list
:
successor_uid_list
.
remove
(
request_software_instance
.
getUid
())
successor
.
edit
(
successor_uid_list
=
successor_uid_list
)
successor
.
edit
(
successor_uid_list
=
successor_uid_list
,
activate_kw
=
{
'tag'
:
tag
}
)
graph
[
successor
.
getUid
()]
=
successor_uid_list
if
instance_found
:
...
...
@@ -142,7 +147,11 @@ if instance_found:
else
:
raise
ValueError
,
"state should be started, stopped or destroyed"
successor_list
=
requester_instance
.
getSuccessorList
()
+
[
request_software_instance_url
]
successor_list
=
requester_instance
.
getSuccessorList
()
successor_uid_list
=
requester_instance
.
getSuccessorUidList
()
if
successor
!=
requester_instance
:
successor_list
.
append
(
request_software_instance_url
)
successor_uid_list
.
append
(
request_software_instance
.
getUid
())
uniq_successor_list
=
list
(
set
(
successor_list
))
successor_list
.
sort
()
uniq_successor_list
.
sort
()
...
...
@@ -150,13 +159,16 @@ if instance_found:
assert
successor_list
==
uniq_successor_list
,
"%s != %s"
%
(
successor_list
,
uniq_successor_list
)
# update graph to reflect requested operation
graph
[
requester_instance
.
getUid
()]
=
requester_instance
.
getSuccessorUidList
()
+
[
request_software_instance
.
getUid
()]
graph
[
requester_instance
.
getUid
()]
=
successor_uid_list
# check if all elements are still connected and if there is no cycle
request_software_instance
.
checkConnected
(
graph
,
instance_tree
.
getUid
())
request_software_instance
.
checkNotCyclic
(
graph
)
requester_instance
.
edit
(
successor_list
=
successor_list
)
if
successor
!=
requester_instance
:
requester_instance
.
edit
(
successor_list
=
successor_list
,
activate_kw
=
{
'tag'
:
tag
}
)
else
:
context
.
REQUEST
.
set
(
'request_instance'
,
None
)
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