mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Catch SSOwat persistent configuration write error.
This commit is contained in:
parent
937f26bdaa
commit
d95052a9e9
4 changed files with 11 additions and 6 deletions
|
@ -209,7 +209,8 @@
|
|||
"service_unknown": "Unknown service '{service:s}'",
|
||||
"ssowat_conf_generated": "The SSOwat configuration has been generated",
|
||||
"ssowat_conf_updated": "The SSOwat configuration has been updated",
|
||||
"ssowat_persistent_conf_error": "Erro while reading SSOwat persistent configuration",
|
||||
"ssowat_persistent_conf_read_error": "Error while reading SSOwat persistent configuration",
|
||||
"ssowat_persistent_conf_write_error": "Error while saving SSOwat persistent configuration",
|
||||
"system_upgraded": "The system has been upgraded",
|
||||
"system_username_exists": "Username already exists in the system users",
|
||||
"unbackup_app": "App '{app:s}' will not be saved",
|
||||
|
|
|
@ -808,7 +808,7 @@ def app_makedefault(auth, app, domain=None):
|
|||
ssowat_conf = json.loads(str(json_conf.read()))
|
||||
except ValueError:
|
||||
raise MoulinetteError(errno.EINVAL,
|
||||
m18n.n('ssowat_persistent_conf_error'))
|
||||
m18n.n('ssowat_persistent_conf_read_error'))
|
||||
except IOError:
|
||||
ssowat_conf = {}
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ def tools_postinstall(domain, password, ignore_dyndns=False):
|
|||
ssowat_conf = json.loads(str(json_conf.read()))
|
||||
except ValueError:
|
||||
raise MoulinetteError(errno.EINVAL,
|
||||
m18n.n('ssowat_persistent_conf_error'))
|
||||
m18n.n('ssowat_persistent_conf_read_error'))
|
||||
except IOError:
|
||||
ssowat_conf = {}
|
||||
|
||||
|
|
|
@ -179,15 +179,19 @@ def user_create(auth, username, firstname, lastname, mail, password,
|
|||
ssowat_conf = json.loads(str(json_conf.read()))
|
||||
except ValueError:
|
||||
raise MoulinetteError(errno.EINVAL,
|
||||
m18n.n('ssowat_persistent_conf_error'))
|
||||
m18n.n('ssowat_persistent_conf_read_error'))
|
||||
except IOError:
|
||||
ssowat_conf = {}
|
||||
|
||||
if 'redirected_urls' in ssowat_conf and '/' in ssowat_conf['redirected_urls']:
|
||||
del ssowat_conf['redirected_urls']['/']
|
||||
|
||||
with open('/etc/ssowat/conf.json.persistent', 'w+') as f:
|
||||
json.dump(ssowat_conf, f, sort_keys=True, indent=4)
|
||||
try:
|
||||
with open('/etc/ssowat/conf.json.persistent', 'w+') as f:
|
||||
json.dump(ssowat_conf, f, sort_keys=True, indent=4)
|
||||
except IOError:
|
||||
raise MoulinetteError(errno.EINVAL,
|
||||
m18n.n('ssowat_persistent_conf_write_error'))
|
||||
|
||||
|
||||
if auth.add(rdn, attr_dict):
|
||||
|
|
Loading…
Add table
Reference in a new issue