mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge pull request #1131 from YunoHost/fix-legacy-persistent-migration
use read_yaml for json because lol
This commit is contained in:
commit
2f856cbe07
1 changed files with 6 additions and 4 deletions
|
@ -2,7 +2,7 @@ import os
|
|||
from moulinette import m18n
|
||||
from yunohost.utils.error import YunohostError
|
||||
from moulinette.utils.log import getActionLogger
|
||||
from moulinette.utils.filesystem import read_json, write_to_json, read_yaml
|
||||
from moulinette.utils.filesystem import write_to_json, read_yaml
|
||||
|
||||
from yunohost.user import user_list, user_group_create, user_group_update
|
||||
from yunohost.app import app_setting, _installed_apps, _get_app_settings, _set_app_settings
|
||||
|
@ -211,10 +211,12 @@ def migrate_legacy_permission_settings(app=None):
|
|||
|
||||
def translate_legacy_rules_in_ssowant_conf_json_persistent():
|
||||
|
||||
if not os.path.exists("/etc/ssowat/conf.json.persistent"):
|
||||
persistent_file_name = "/etc/ssowat/conf.json.persistent"
|
||||
if not os.path.exists(persistent_file_name):
|
||||
return
|
||||
|
||||
persistent = read_json("/etc/ssowat/conf.json.persistent")
|
||||
# Ugly hack to try not to misarably fail migration
|
||||
persistent = read_yaml(persistent_file_name)
|
||||
|
||||
legacy_rules = [
|
||||
"skipped_urls",
|
||||
|
@ -271,6 +273,6 @@ def translate_legacy_rules_in_ssowant_conf_json_persistent():
|
|||
"uris": protected_urls + persistent["permissions"].get("custom_protected", {}).get("uris", []),
|
||||
}
|
||||
|
||||
write_to_json("/etc/ssowat/conf.json.persistent", persistent, sort_keys=True, indent=4)
|
||||
write_to_json(persistent_file_name, persistent, sort_keys=True, indent=4)
|
||||
|
||||
logger.warning("Yunohost automatically translated some legacy rules in /etc/ssowat/conf.json.persistent to match the new permission system")
|
||||
|
|
Loading…
Add table
Reference in a new issue