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
f2ba8cb3
Commit
f2ba8cb3
authored
Dec 01, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_upgrader: generate a graph showing the virtual master relation
parent
3633c16d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
127 additions
and
0 deletions
+127
-0
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/Base_reportVirtualMasterMigration.py
...kins/slapos_upgrader/Base_reportVirtualMasterMigration.py
+65
-0
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/Base_reportVirtualMasterMigration.xml
...ins/slapos_upgrader/Base_reportVirtualMasterMigration.xml
+62
-0
No files found.
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/Base_reportVirtualMasterMigration.py
0 → 100644
View file @
f2ba8cb3
# https://playground.diagram.codes/d/graph
portal
=
context
.
getPortalObject
()
print
"ARROWS"
print
""
project_dict
=
{}
remote_project_dict
=
{}
group_by_list
=
[
"follow_up__uid"
]
sql_result_list
=
context
.
getPortalObject
().
portal_catalog
(
select_list
=
group_by_list
+
[
'count(*)'
],
portal_type
=
"Instance Tree"
,
slap_state
=
[
"start_requested"
,
"stop_requested"
],
group_by
=
group_by_list
)
for
sql_result
in
sql_result_list
:
project_dict
[
sql_result
.
getFollowUpUid
()]
=
{
'title'
:
'%s (%s)'
%
(
sql_result
.
getFollowUpTitle
(),
sql_result
[
'count(*)'
]),
'remote_uid_list'
:
[]
}
for
sql_remote
in
context
.
getPortalObject
().
portal_catalog
(
portal_type
=
"Remote Node"
,
follow_up__uid
=
sql_result
.
getFollowUpUid
()
):
project_dict
[
sql_result
.
getFollowUpUid
()][
'remote_uid_list'
].
append
(
sql_remote
.
getDestinationProjectUid
())
remote_project_dict
[
sql_remote
.
getDestinationProjectUid
()]
=
True
project_dict
[
sql_result
.
getFollowUpUid
()][
'remote_uid_list'
]
=
sorted
(
project_dict
[
sql_result
.
getFollowUpUid
()][
'remote_uid_list'
])
# Calculate all the nodes
# Remote projects will be standalone
# Other project will be grouped by their remote
display_dict
=
{}
for
project_uid
,
project_value_dict
in
project_dict
.
items
():
if
project_uid
in
remote_project_dict
:
display_dict
[
project_uid
]
=
project_value_dict
else
:
remote_key
=
'remote_%s'
%
''
.
join
(
sorted
([
str
(
x
)
for
x
in
project_value_dict
[
'remote_uid_list'
]]))
or
'couscous'
if
remote_key
not
in
display_dict
:
display_dict
[
remote_key
]
=
{
'remote_uid_list'
:
project_value_dict
[
'remote_uid_list'
],
'title'
:
project_value_dict
[
'title'
]
}
else
:
display_dict
[
remote_key
][
'title'
]
=
'%s
\
n
%s'
%
(
display_dict
[
remote_key
][
'title'
],
project_value_dict
[
'title'
])
for
display_key
,
display_value
in
display_dict
.
items
():
print
'"%s" as %s'
%
(
display_value
[
'title'
],
display_key
)
print
''
for
display_key
,
display_value
in
display_dict
.
items
():
has_remote
=
False
for
remote_uid
in
display_value
[
'remote_uid_list'
]:
if
remote_uid
in
display_dict
:
# only not destroyed links
has_remote
=
True
print
'%s->%s'
%
(
display_key
,
remote_uid
)
if
(
not
has_remote
)
and
(
display_key
not
in
remote_project_dict
):
print
'%s->%s'
%
(
display_key
,
display_key
)
print
''
return
printed
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/Base_reportVirtualMasterMigration.xml
0 → 100644
View file @
f2ba8cb3
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"_reconstructor"
module=
"copy_reg"
/>
</klass>
<tuple>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
<global
name=
"object"
module=
"__builtin__"
/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_reportVirtualMasterMigration
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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