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
9cb7298a
Commit
9cb7298a
authored
Nov 21, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_upgrader: migrate compute node
parent
1bc9e78a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
155 additions
and
5 deletions
+155
-5
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/Base_activateObjectMigrationToVirtualMaster.py
...s_upgrader/Base_activateObjectMigrationToVirtualMaster.py
+6
-0
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/Base_activateObjectMigrationToVirtualMaster.xml
..._upgrader/Base_activateObjectMigrationToVirtualMaster.xml
+62
-0
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/ComputeNode_checkSiteMigrationToVirtualMaster.py
...upgrader/ComputeNode_checkSiteMigrationToVirtualMaster.py
+2
-2
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/ComputeNode_triggerObjectMigrationToVirtualMaster.py
...ader/ComputeNode_triggerObjectMigrationToVirtualMaster.py
+16
-0
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/ComputeNode_triggerObjectMigrationToVirtualMaster.xml
...der/ComputeNode_triggerObjectMigrationToVirtualMaster.xml
+62
-0
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/Person_checkSiteMigrationCreatePersonalVirtualMaster.py
...r/Person_checkSiteMigrationCreatePersonalVirtualMaster.py
+6
-2
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/Person_checkSiteMigrationCreatePersonalVirtualMaster.xml
.../Person_checkSiteMigrationCreatePersonalVirtualMaster.xml
+1
-1
No files found.
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/Base_activateObjectMigrationToVirtualMaster.py
0 → 100644
View file @
9cb7298a
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
return
context
.
getTypeBasedMethod
(
'triggerObjectMigrationToVirtualMaster'
)(
project_relative_url
)
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/Base_activateObjectMigrationToVirtualMaster.xml
0 → 100644
View file @
9cb7298a
<?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>
project_relative_url, REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_activateObjectMigrationToVirtualMaster
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/ComputeNode_checkSiteMigrationToVirtualMaster.py
View file @
9cb7298a
...
...
@@ -57,7 +57,7 @@ if (len(not_migrated_compute_node['instance_list']) == 0) and \
personal_virtual_master_dict
[
not_migrated_compute_node
[
'source_administration'
]][
'compute_node_list'
].
append
(
compute_node_relative_url
)
not_migrated_compute_node_dict
.
pop
(
compute_node_relative_url
)
source_administration_value
.
Person_checkSiteMigrationCreatePersonalVirtualMaster
()
source_administration_value
.
Person_checkSiteMigrationCreatePersonalVirtualMaster
(
[
compute_node_relative_url
]
)
# Node linked to a project
elif
not_migrated_compute_node
[
'project_relative_url'
]
is
not
None
:
...
...
@@ -84,7 +84,7 @@ else:
if
from_same_user_only
:
not_migrated_compute_node_dict
.
pop
(
compute_node_relative_url
)
source_administration_value
.
Person_checkSiteMigrationCreatePersonalVirtualMaster
()
source_administration_value
.
Person_checkSiteMigrationCreatePersonalVirtualMaster
(
[
compute_node_relative_url
]
)
# Log
...
...
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/ComputeNode_triggerObjectMigrationToVirtualMaster.py
0 → 100644
View file @
9cb7298a
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
portal
=
context
.
getPortalObject
()
compute_node
=
context
project
=
portal
.
restrictedTraverse
(
project_relative_url
)
# Check if it has been migrated first
if
compute_node
.
getFollowUpValue
()
is
not
None
:
return
# Migrate
# Compute Node only need a link on itself.
compute_node
.
edit
(
follow_up_value
=
project
)
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/ComputeNode_triggerObjectMigrationToVirtualMaster.xml
0 → 100644
View file @
9cb7298a
<?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>
project_relative_url, REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ComputeNode_triggerObjectMigrationToVirtualMaster
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/Person_checkSiteMigrationCreatePersonalVirtualMaster.py
View file @
9cb7298a
...
...
@@ -19,12 +19,12 @@ wait_activate_kw = {
# Delay the script to prevent conflict with serialize
# in the caller script
if
is_first_call
:
return
person
.
activate
(
**
wait_activate_kw
).
Person_checkSiteMigrationCreatePersonalVirtualMaster
(
tag
=
tag
,
*
args
,
**
kw
)
return
person
.
activate
(
**
wait_activate_kw
).
Person_checkSiteMigrationCreatePersonalVirtualMaster
(
relative_url_to_migrate_list
,
tag
=
tag
,
*
args
,
**
kw
)
# Prevent concurrent activities
person
.
serialize
()
if
0
<
portal
.
portal_activities
.
countMessageWithTag
(
tag
):
return
person
.
activate
(
**
wait_activate_kw
).
Person_checkSiteMigrationCreatePersonalVirtualMaster
(
tag
=
tag
,
*
args
,
**
kw
)
return
person
.
activate
(
**
wait_activate_kw
).
Person_checkSiteMigrationCreatePersonalVirtualMaster
(
relative_url_to_migrate_list
,
tag
=
tag
,
*
args
,
**
kw
)
# No concurrent activity.
# Search the existing virtual master
...
...
@@ -43,6 +43,7 @@ if project is None:
title
=
virtual_master_title
,
is_compute_node_payable
=
False
,
is_instance_tree_payable
=
False
,
# Hardcoded
price_currency
=
'currency_module/EUR'
,
batch
=
1
,
activate_kw
=
activate_kw
...
...
@@ -50,3 +51,6 @@ if project is None:
context
.
log
(
'%s 2 %s'
%
(
script
.
id
,
project
))
# XXX Then, migrate other documents linked to the virtual master
for
relative_url_to_migrate
in
relative_url_to_migrate_list
:
object_to_migrate
=
portal
.
restrictedTraverse
(
relative_url_to_migrate
)
object_to_migrate
.
activate
(
serialization_tag
=
'Person_checkSiteMigrationCreatePersonalVirtualMaster_%s'
%
relative_url_to_migrate
).
Base_activateObjectMigrationToVirtualMaster
(
project
.
getRelativeUrl
())
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/Person_checkSiteMigrationCreatePersonalVirtualMaster.xml
View file @
9cb7298a
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None, tag=None, *args, **kw
</string>
</value>
<value>
<string>
relative_url_to_migrate_list,
REQUEST=None, tag=None, *args, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
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