diff --git a/src/yunohost/data_migrations/0002_migrate_to_tsig_sha256.py b/src/yunohost/data_migrations/0002_migrate_to_tsig_sha256.py index 824245c82..cc5d4c19b 100644 --- a/src/yunohost/data_migrations/0002_migrate_to_tsig_sha256.py +++ b/src/yunohost/data_migrations/0002_migrate_to_tsig_sha256.py @@ -19,10 +19,6 @@ class MyMigration(Migration): "Migrate Dyndns stuff from MD5 TSIG to SHA512 TSIG" - def backward(self): - # Not possible because that's a non-reversible operation ? - pass - def migrate(self, dyn_host="dyndns.yunohost.org", domain=None, private_key_path=None): if domain is None or private_key_path is None: diff --git a/src/yunohost/data_migrations/0003_migrate_to_stretch.py b/src/yunohost/data_migrations/0003_migrate_to_stretch.py index 8b7586701..0db6cfd6d 100644 --- a/src/yunohost/data_migrations/0003_migrate_to_stretch.py +++ b/src/yunohost/data_migrations/0003_migrate_to_stretch.py @@ -29,11 +29,7 @@ class MyMigration(Migration): mode = "manual" - def backward(self): - - raise YunohostError("migration_backward_impossible", name=self.name) - - def migrate(self): + def forward(self): self.logfile = "/var/log/yunohost/{}.log".format(self.name) diff --git a/src/yunohost/data_migrations/0004_php5_to_php7_pools.py b/src/yunohost/data_migrations/0004_php5_to_php7_pools.py index faf9ccbbc..e916a9cd7 100644 --- a/src/yunohost/data_migrations/0004_php5_to_php7_pools.py +++ b/src/yunohost/data_migrations/0004_php5_to_php7_pools.py @@ -24,7 +24,7 @@ class MyMigration(Migration): dependencies = ["migrate_to_stretch"] - def migrate(self): + def forward(self): # Get list of php5 pool files php5_pool_files = glob.glob("{}/*.conf".format(PHP5_POOLS)) diff --git a/src/yunohost/data_migrations/0005_postgresql_9p4_to_9p6.py b/src/yunohost/data_migrations/0005_postgresql_9p4_to_9p6.py index 50c0561cb..9cb6e51bd 100644 --- a/src/yunohost/data_migrations/0005_postgresql_9p4_to_9p6.py +++ b/src/yunohost/data_migrations/0005_postgresql_9p4_to_9p6.py @@ -16,7 +16,7 @@ class MyMigration(Migration): dependencies = ["migrate_to_stretch"] - def migrate(self): + def forward(self): if not self.package_is_installed("postgresql-9.4"): logger.warning(m18n.n("migration_0005_postgresql_94_not_installed")) @@ -34,10 +34,6 @@ class MyMigration(Migration): subprocess.check_call("pg_dropcluster --stop 9.4 main", shell=True) subprocess.check_call("service postgresql start", shell=True) - def backward(self): - - pass - def package_is_installed(self, package_name): p = subprocess.Popen("dpkg --list | grep '^ii ' | grep -q -w {}".format(package_name), shell=True) diff --git a/src/yunohost/data_migrations/0006_sync_admin_and_root_passwords.py b/src/yunohost/data_migrations/0006_sync_admin_and_root_passwords.py index cd13d680d..953652111 100644 --- a/src/yunohost/data_migrations/0006_sync_admin_and_root_passwords.py +++ b/src/yunohost/data_migrations/0006_sync_admin_and_root_passwords.py @@ -20,16 +20,13 @@ class MyMigration(Migration): "Synchronize admin and root passwords" - def migrate(self): + def forward(self): new_hash = self._get_admin_hash() self._replace_root_hash(new_hash) logger.info(m18n.n("root_password_replaced_by_admin_password")) - def backward(self): - pass - @property def mode(self): diff --git a/src/yunohost/data_migrations/0007_ssh_conf_managed_by_yunohost_step1.py b/src/yunohost/data_migrations/0007_ssh_conf_managed_by_yunohost_step1.py index feffdc27c..7ddcec7fd 100644 --- a/src/yunohost/data_migrations/0007_ssh_conf_managed_by_yunohost_step1.py +++ b/src/yunohost/data_migrations/0007_ssh_conf_managed_by_yunohost_step1.py @@ -34,7 +34,7 @@ class MyMigration(Migration): use the recommended configuration, with an appropriate disclaimer. """ - def migrate(self): + def forward(self): # Check if deprecated DSA Host Key is in config dsa_rgx = r'^[ \t]*HostKey[ \t]+/etc/ssh/ssh_host_dsa_key[ \t]*(?:#.*)?$' diff --git a/src/yunohost/data_migrations/0008_ssh_conf_managed_by_yunohost_step2.py b/src/yunohost/data_migrations/0008_ssh_conf_managed_by_yunohost_step2.py index 0ea0ddc3a..c158192f9 100644 --- a/src/yunohost/data_migrations/0008_ssh_conf_managed_by_yunohost_step2.py +++ b/src/yunohost/data_migrations/0008_ssh_conf_managed_by_yunohost_step2.py @@ -35,7 +35,7 @@ class MyMigration(Migration): dependencies = ["ssh_conf_managed_by_yunohost_step1"] - def migrate(self): + def forward(self): settings_set("service.ssh.allow_deprecated_dsa_hostkey", False) regen_conf(names=['ssh'], force=True) @@ -44,10 +44,6 @@ class MyMigration(Migration): if os.path.isdir(ARCHIVES_PATH): chown(ARCHIVES_PATH, uid="admin", gid="root") - def backward(self): - - raise YunohostError("migration_backward_impossible", name=self.name) - @property def mode(self): diff --git a/src/yunohost/data_migrations/0009_decouple_regenconf_from_services.py b/src/yunohost/data_migrations/0009_decouple_regenconf_from_services.py index d552d7c9c..ffe2279a8 100644 --- a/src/yunohost/data_migrations/0009_decouple_regenconf_from_services.py +++ b/src/yunohost/data_migrations/0009_decouple_regenconf_from_services.py @@ -17,7 +17,7 @@ class MyMigration(Migration): Decouple the regen conf mechanism from the concept of services """ - def migrate(self): + def forward(self): if "conffiles" not in read_file("/etc/yunohost/services.yml") \ or os.path.exists(REGEN_CONF_FILE): @@ -37,6 +37,3 @@ class MyMigration(Migration): # (Actually save the modification of services) _save_services(services) - def backward(self): - - pass diff --git a/src/yunohost/data_migrations/0010_migrate_to_apps_json.py b/src/yunohost/data_migrations/0010_migrate_to_apps_json.py index 43ae9a86f..7092d92c7 100644 --- a/src/yunohost/data_migrations/0010_migrate_to_apps_json.py +++ b/src/yunohost/data_migrations/0010_migrate_to_apps_json.py @@ -15,7 +15,7 @@ class MyMigration(Migration): "Migrate from official.json to apps.json" - def migrate(self): + def forward(self): # Backup current app list json os.system("cp %s %s" % (APPSLISTS_JSON, APPSLISTS_BACKUP)) diff --git a/src/yunohost/data_migrations/0011_setup_group_permission.py b/src/yunohost/data_migrations/0011_setup_group_permission.py index 05c426936..0e371944e 100644 --- a/src/yunohost/data_migrations/0011_setup_group_permission.py +++ b/src/yunohost/data_migrations/0011_setup_group_permission.py @@ -92,7 +92,7 @@ class MyMigration(Migration): app_setting(app, 'allowed_users', delete=True) - def migrate(self): + def forward(self): # Check if the migration can be processed ldap_regen_conf_status = regen_conf(names=['slapd'], dry_run=True) # By this we check if the have been customized diff --git a/src/yunohost/tools.py b/src/yunohost/tools.py index a6379e62b..59758acdf 100644 --- a/src/yunohost/tools.py +++ b/src/yunohost/tools.py @@ -1316,7 +1316,7 @@ class Migration(object): raise NotImplementedError() def backward(self): - pass + raise YunohostError("migration_backward_impossible", name=self.name) @property def disclaimer(self):