mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Manage the auto/manual flag in migrations_migrate
This commit is contained in:
parent
c40f14e8f0
commit
c568b04459
4 changed files with 18 additions and 4 deletions
|
@ -1589,6 +1589,9 @@ tools:
|
|||
help: skip the migration(s), use it only if you know what you are doing
|
||||
full: --skip
|
||||
action: store_true
|
||||
--auto:
|
||||
help: automatic mode, won't run manual migrations, use it only if you know what you are doing
|
||||
action: store_true
|
||||
|
||||
|
||||
### tools_migrations_state()
|
||||
|
|
2
debian/postinst
vendored
2
debian/postinst
vendored
|
@ -15,7 +15,7 @@ do_configure() {
|
|||
yunohost service regen-conf --output-as none
|
||||
|
||||
echo "Launching migrations.."
|
||||
yunohost tools migrations migrate
|
||||
yunohost tools migrations migrate --auto
|
||||
|
||||
# restart yunohost-firewall if it's running
|
||||
service yunohost-firewall status >/dev/null \
|
||||
|
|
|
@ -236,6 +236,7 @@
|
|||
"migrations_show_currently_running_migration": "Running migration {number} {name}...",
|
||||
"migrations_show_last_migration": "Last ran migration is {}",
|
||||
"migrations_skip_migration": "Skipping migration {number} {name}...",
|
||||
"migrations_to_be_ran_manually": "Migration {number} {name} has to be ran manually. Please go to Tools > Migrations on the webadmin, or run `yunohost tools migrations migrate`.",
|
||||
"monitor_disabled": "The server monitoring has been disabled",
|
||||
"monitor_enabled": "The server monitoring has been enabled",
|
||||
"monitor_glances_con_failed": "Unable to connect to Glances server",
|
||||
|
|
|
@ -753,7 +753,7 @@ def tools_migrations_list():
|
|||
return migrations
|
||||
|
||||
|
||||
def tools_migrations_migrate(target=None, skip=False):
|
||||
def tools_migrations_migrate(target=None, skip=False, auto=False):
|
||||
"""
|
||||
Perform migrations
|
||||
"""
|
||||
|
@ -816,8 +816,18 @@ def tools_migrations_migrate(target=None, skip=False):
|
|||
# effectively run selected migrations
|
||||
for migration in migrations:
|
||||
if not skip:
|
||||
logger.warn(m18n.n('migrations_show_currently_running_migration',
|
||||
number=migration.number, name=migration.name))
|
||||
|
||||
# If we are migrating in "automatic mode" (i.e. from debian
|
||||
# configure during an upgrade of the package) but the migration
|
||||
# is to be ran manually by the user
|
||||
if auto and migration.mode == "manual":
|
||||
logger.warn(m18n.n('migrations_to_be_ran_manually',
|
||||
number=migration.number, name=migration.name))
|
||||
break
|
||||
else:
|
||||
logger.warn(m18n.n('migrations_show_currently_running_migration',
|
||||
number=migration.number, name=migration.name))
|
||||
|
||||
|
||||
try:
|
||||
if mode == "forward":
|
||||
|
|
Loading…
Add table
Reference in a new issue