From 4186f757e1f6c32d072fdfe201ff2013a0ad5daf Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 22 Sep 2020 17:48:00 +0200 Subject: [PATCH 1/4] Cleanup some old stuff in postinstall code --- src/yunohost/tools.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/yunohost/tools.py b/src/yunohost/tools.py index fcc2810d6..946c876e4 100644 --- a/src/yunohost/tools.py +++ b/src/yunohost/tools.py @@ -303,17 +303,10 @@ def tools_postinstall(operation_logger, domain, password, ignore_dyndns=False, # Change folders permissions os.system('chmod 755 /home/yunohost.app') - # Set hostname to avoid amavis bug - if os.system('hostname -d >/dev/null') != 0: - os.system('hostname yunohost.yunohost.org') - - # Add a temporary SSOwat rule to redirect SSO to admin page + # Init ssowat's conf.json.persistent if not os.path.exists('/etc/ssowat/conf.json.persistent'): - ssowat_conf = {} - else: - ssowat_conf = read_json('/etc/ssowat/conf.json.persistent') + write_to_json('/etc/ssowat/conf.json.persistent', {}) - write_to_json('/etc/ssowat/conf.json.persistent', ssowat_conf) os.system('chmod 644 /etc/ssowat/conf.json.persistent') # Create SSL CA From 95f6772cba53b6c2f8f865f5b3d5c66d4b653c56 Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Wed, 23 Sep 2020 03:25:26 +0200 Subject: [PATCH 2/4] [fix] Typo and ssh as system perm --- src/yunohost/permission.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yunohost/permission.py b/src/yunohost/permission.py index cd81489a2..010913556 100644 --- a/src/yunohost/permission.py +++ b/src/yunohost/permission.py @@ -35,7 +35,7 @@ from yunohost.log import is_unit_operation logger = getActionLogger('yunohost.user') -SYSTEM_PERMS = ["mail", "xmpp", "stfp"] +SYSTEM_PERMS = ["mail", "xmpp", "sftp", "ssh"] # # From ae897994cacfd764870ac9f8569d3e3cdc9633ec Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 23 Sep 2020 21:33:10 +0200 Subject: [PATCH 3/4] Remove legacy stuff, every instances that got migrated to Buster already have this applied --- src/yunohost/tools.py | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/src/yunohost/tools.py b/src/yunohost/tools.py index 946c876e4..8799102db 100644 --- a/src/yunohost/tools.py +++ b/src/yunohost/tools.py @@ -908,44 +908,12 @@ def tools_migrations_state(): """ Show current migration state """ - if os.path.exists("/etc/yunohost/migrations_state.json"): - _migrate_legacy_migration_json() - if not os.path.exists(MIGRATIONS_STATE_PATH): return {"migrations": {}} return read_yaml(MIGRATIONS_STATE_PATH) -def _migrate_legacy_migration_json(): - - from moulinette.utils.filesystem import read_json - - logger.debug("Migrating legacy migration state json to yaml...") - - # We fetch the old state containing the last run migration - old_state = read_json("/etc/yunohost/migrations_state.json")["last_run_migration"] - last_run_migration_id = str(old_state["number"]) + "_" + old_state["name"] - - # Extract the list of migration ids - from . import data_migrations - migrations_path = data_migrations.__path__[0] - migration_files = filter(lambda x: re.match(r"^\d+_[a-zA-Z0-9_]+\.py$", x), os.listdir(migrations_path)) - # (here we remove the .py extension and make sure the ids are sorted) - migration_ids = sorted([f.rsplit(".", 1)[0] for f in migration_files]) - - # So now build the new dict for every id up to the last run migration - migrations = {} - for migration_id in migration_ids: - migrations[migration_id] = "done" - if last_run_migration_id in migration_id: - break - - # Write the new file and rename the old one - write_to_yaml(MIGRATIONS_STATE_PATH, {"migrations": migrations}) - os.rename("/etc/yunohost/migrations_state.json", "/etc/yunohost/migrations_state.json.old") - - def _write_migration_state(migration_id, state): current_states = tools_migrations_state() From f2b6a883a8200b58daa2210df401a278c84932ec Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 23 Sep 2020 21:37:08 +0200 Subject: [PATCH 4/4] Unused import --- src/yunohost/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yunohost/tools.py b/src/yunohost/tools.py index 8799102db..1c45ef770 100644 --- a/src/yunohost/tools.py +++ b/src/yunohost/tools.py @@ -33,7 +33,7 @@ from importlib import import_module from moulinette import msignals, m18n from moulinette.utils.log import getActionLogger from moulinette.utils.process import check_output, call_async_output -from moulinette.utils.filesystem import read_json, write_to_json, read_yaml, write_to_yaml +from moulinette.utils.filesystem import write_to_json, read_yaml, write_to_yaml from yunohost.app import _update_apps_catalog, app_info, app_upgrade, _initialize_apps_catalog_system from yunohost.domain import domain_add