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
6fab175c
Commit
6fab175c
authored
Nov 22, 2023
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_upgrader: do not create not needed activities
parent
64586594
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
16 deletions
+11
-16
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/Person_checkSiteMigrationCreatePersonalVirtualMaster.py
...r/Person_checkSiteMigrationCreatePersonalVirtualMaster.py
+11
-16
No files found.
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/Person_checkSiteMigrationCreatePersonalVirtualMaster.py
View file @
6fab175c
...
@@ -17,29 +17,25 @@ wait_activate_kw = {
...
@@ -17,29 +17,25 @@ wait_activate_kw = {
'after_tag'
:
tag
'after_tag'
:
tag
}
}
# Delay the script to prevent conflict with serialize
# in the caller script
if
is_first_call
:
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
(
relative_url_to_migrate_list
,
tag
=
tag
,
*
args
,
**
kw
)
# No concurrent activity.
# Search the existing virtual master
# Search the existing virtual master
virtual_master_title
=
'Migrated personal for %s'
%
person
.
getTitle
()
virtual_master_title
=
'Migrated personal for %s'
%
person
.
getTitle
()
project
=
portal
.
portal_catalog
.
getResultValue
(
project
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Project'
,
portal_type
=
'Project'
,
destination__uid
=
person
.
getUid
(),
destination__uid
=
person
.
getUid
(),
title
=
{
'query'
:
virtual_master_title
,
'key'
:
'ExactMatch'
}
title
=
{
'query'
:
virtual_master_title
,
'key'
:
'ExactMatch'
}
)
)
# Or create it
if
project
is
None
:
if
project
is
None
:
context
.
log
(
'%s 1 %s'
%
(
script
.
id
,
person
.
getRelativeUrl
()))
# Delay the script to prevent conflict with serialize
# in the caller script
# Prevent concurrent activities
if
is_first_call
or
(
0
<
portal
.
portal_activities
.
countMessageWithTag
(
tag
)):
return
person
.
activate
(
**
wait_activate_kw
).
Person_checkSiteMigrationCreatePersonalVirtualMaster
(
relative_url_to_migrate_list
,
tag
=
tag
,
*
args
,
**
kw
)
person
.
serialize
()
# No concurrent activity.
# Create it
project
=
person
.
Person_addVirtualMaster
(
project
=
person
.
Person_addVirtualMaster
(
title
=
virtual_master_title
,
title
=
virtual_master_title
,
is_compute_node_payable
=
False
,
is_compute_node_payable
=
False
,
...
@@ -49,9 +45,8 @@ if project is None:
...
@@ -49,9 +45,8 @@ if project is None:
batch
=
1
,
batch
=
1
,
activate_kw
=
activate_kw
activate_kw
=
activate_kw
)
)
context
.
log
(
'%s 2 %s'
%
(
script
.
id
,
project
))
# XXX Then, migrate other documents linked to the virtual master
# XXX Then, migrate other documents linked to the virtual master
for
relative_url_to_migrate
in
relative_url_to_migrate_list
:
for
relative_url_to_migrate
in
relative_url_to_migrate_list
:
object_to_migrate
=
portal
.
restrictedTraverse
(
relative_url_to_migrate
)
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
())
object_to_migrate
.
activate
().
Base_activateObjectMigrationToVirtualMaster
(
project
.
getRelativeUrl
())
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