mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge branch 'dev' into fix-1333-update_email_regex
This commit is contained in:
commit
9a4ba0bfe1
2 changed files with 4 additions and 43 deletions
|
@ -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"]
|
||||
|
||||
#
|
||||
#
|
||||
|
|
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -915,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()
|
||||
|
|
Loading…
Add table
Reference in a new issue