From fac44f44d06f120625cbc69fefbb3e28f57093d2 Mon Sep 17 00:00:00 2001 From: ljf Date: Wed, 14 Aug 2019 17:29:24 +0200 Subject: [PATCH] [enh] Avoid to modify untestable migrations --- .../0001_change_cert_group_to_sslcert.py | 9 ++------- .../0007_ssh_conf_managed_by_yunohost_step1.py | 14 ++++---------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/yunohost/data_migrations/0001_change_cert_group_to_sslcert.py b/src/yunohost/data_migrations/0001_change_cert_group_to_sslcert.py index 4338e10f3..5670f3329 100644 --- a/src/yunohost/data_migrations/0001_change_cert_group_to_sslcert.py +++ b/src/yunohost/data_migrations/0001_change_cert_group_to_sslcert.py @@ -11,10 +11,5 @@ class MyMigration(Migration): all_certificate_files = glob.glob("/etc/yunohost/certs/*/*.pem") def run(self): - try: - for filename in self.all_certificate_files: - chown(filename, uid="root", gid="ssl-cert") - except Exception: - for filename in self.all_certificate_files: - chown(filename, uid="root", gid="metronome") - raise + for filename in self.all_certificate_files: + chown(filename, uid="root", gid="ssl-cert") 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 99eb90b19..818760e17 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 @@ -55,13 +55,7 @@ class MyMigration(Migration): # right after the regenconf, such that it will appear as # "manually modified". if os.path.exists('/etc/yunohost/from_script'): - try: - rm('/etc/yunohost/from_script') - copyfile(SSHD_CONF, '/etc/ssh/sshd_config.bkp') - regen_conf(names=['ssh'], force=True) - copyfile('/etc/ssh/sshd_config.bkp', SSHD_CONF) - except Exception: - if os.path.exists('/etc/yunohost/sshd_config.bkp'): - copyfile('/etc/ssh/sshd_config.bkp', SSHD_CONF) - _run_service_command('restart', 'ssh') - raise + rm('/etc/yunohost/from_script') + copyfile(SSHD_CONF, '/etc/ssh/sshd_config.bkp') + regen_conf(names=['ssh'], force=True) + copyfile('/etc/ssh/sshd_config.bkp', SSHD_CONF)