mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Merge branch 'unstable' into stretch-unstable
This commit is contained in:
commit
c07fb8c720
6 changed files with 58 additions and 3 deletions
15
debian/changelog
vendored
15
debian/changelog
vendored
|
@ -4,6 +4,21 @@ moulinette (3.0.0~beta1) testing; urgency=low
|
||||||
|
|
||||||
-- Alexandre Aubin <alex.aubin@mailoo.org> Thu, 03 May 2018 03:04:45 +0000
|
-- Alexandre Aubin <alex.aubin@mailoo.org> Thu, 03 May 2018 03:04:45 +0000
|
||||||
|
|
||||||
|
moulinette (2.7.13) testing; urgency=low
|
||||||
|
|
||||||
|
* [i18n] Improve translations for Portugueuse, Occitan
|
||||||
|
* [enh] Add read_yaml util (#161)
|
||||||
|
|
||||||
|
Contributors : Bram, by0ne, Quent-in
|
||||||
|
|
||||||
|
-- Alexandre Aubin <alex.aubin@mailoo.org> Mon, 28 May 2018 02:55:00 +0000
|
||||||
|
|
||||||
|
moulinette (2.7.12) stable; urgency=low
|
||||||
|
|
||||||
|
* Bumping version number for stable release
|
||||||
|
|
||||||
|
-- Alexandre Aubin <alex.aubin@mailoo.org> Sun, 06 May 2018 16:57:18 +0000
|
||||||
|
|
||||||
moulinette (2.7.11) testing; urgency=low
|
moulinette (2.7.11) testing; urgency=low
|
||||||
|
|
||||||
* [i18n] Improve translations for Arabic, Dutch, French, Occitan, Spanish
|
* [i18n] Improve translations for Arabic, Dutch, French, Occitan, Spanish
|
||||||
|
|
|
@ -3,6 +3,7 @@ File system operation utils
|
||||||
|
|
||||||
.. autofunction:: moulinette.utils.filesystem.read_file
|
.. autofunction:: moulinette.utils.filesystem.read_file
|
||||||
.. autofunction:: moulinette.utils.filesystem.read_json
|
.. autofunction:: moulinette.utils.filesystem.read_json
|
||||||
|
.. autofunction:: moulinette.utils.filesystem.read_yaml
|
||||||
.. autofunction:: moulinette.utils.filesystem.write_to_file
|
.. autofunction:: moulinette.utils.filesystem.write_to_file
|
||||||
.. autofunction:: moulinette.utils.filesystem.append_to_file
|
.. autofunction:: moulinette.utils.filesystem.append_to_file
|
||||||
.. autofunction:: moulinette.utils.filesystem.write_to_json
|
.. autofunction:: moulinette.utils.filesystem.write_to_json
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
"cannot_write_file": "Could not write file {file:s} (reason: {error:s})",
|
"cannot_write_file": "Could not write file {file:s} (reason: {error:s})",
|
||||||
"unknown_error_reading_file": "Unknown error while trying to read file {file:s}",
|
"unknown_error_reading_file": "Unknown error while trying to read file {file:s}",
|
||||||
"corrupted_json": "Corrupted json read from {ressource:s} (reason: {error:s})",
|
"corrupted_json": "Corrupted json read from {ressource:s} (reason: {error:s})",
|
||||||
|
"corrupted_yaml": "Corrupted yaml read from {ressource:s} (reason: {error:s})",
|
||||||
"error_writing_file": "Error when writing file {file:s}: {error:s}",
|
"error_writing_file": "Error when writing file {file:s}: {error:s}",
|
||||||
"error_removing": "Error when removing {path:s}: {error:s}",
|
"error_removing": "Error when removing {path:s}: {error:s}",
|
||||||
"error_changing_file_permissions": "Error when changing permissions for {path:s}: {error:s}",
|
"error_changing_file_permissions": "Error when changing permissions for {path:s}: {error:s}",
|
||||||
|
|
|
@ -2,5 +2,8 @@
|
||||||
"argument_required": "L'argument {argument} es requesit",
|
"argument_required": "L'argument {argument} es requesit",
|
||||||
"authentication_profile_required": "L'identificacion del perfil {profile} es reqursida",
|
"authentication_profile_required": "L'identificacion del perfil {profile} es reqursida",
|
||||||
"authentication_required": "Autentificacion requesida",
|
"authentication_required": "Autentificacion requesida",
|
||||||
"authentication_required_long": "Una autentificacion es requesida per acomplir aquesta accion"
|
"authentication_required_long": "Una autentificacion es requesida per acomplir aquesta accion",
|
||||||
|
"logged_in": "Connectat",
|
||||||
|
"logged_out": "Desconnectat",
|
||||||
|
"password": "Senhal"
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,19 @@
|
||||||
"websocket_request_expected": "Esperado um pedido a WebSocket",
|
"websocket_request_expected": "Esperado um pedido a WebSocket",
|
||||||
"deprecated_command": "'{prog} {command}' está obsoleto e será removido no futuro",
|
"deprecated_command": "'{prog} {command}' está obsoleto e será removido no futuro",
|
||||||
"deprecated_command_alias": "'{prog} {old}' está obsoleto e será removido no futuro, em vez disso, usa '{prog} {new}'",
|
"deprecated_command_alias": "'{prog} {old}' está obsoleto e será removido no futuro, em vez disso, usa '{prog} {new}'",
|
||||||
"error_see_log": "Um erro ocorreu. Por favor, veja mais detalhes no log.",
|
"error_see_log": "Ocorreu um erro . Por favor, veja os logs para maiores detalhes, eles estão localizados em /var/log/yunohost/.",
|
||||||
"unknown_group": "Grupo '{group}' desconhecido",
|
"unknown_group": "Grupo '{group}' desconhecido",
|
||||||
"unknown_user": "Nome de utilizador '{user}' desconhecido"
|
"unknown_user": "Nome de utilizador '{user}' desconhecido",
|
||||||
|
"cannot_open_file": "Não foi possível abrir o arquivo {file:s} (reason: {error:s})",
|
||||||
|
"cannot_write_file": "Não foi possível abrir o arquivo {file:s} (reason: {error:s})",
|
||||||
|
"unknown_error_reading_file": "Erro desconhecido ao tentar ler o arquivo {file:s}",
|
||||||
|
"error_writing_file": "Erro ao gravar arquivo {file:s}: {error:s}",
|
||||||
|
"error_removing": "Erro ao remover {path:s}: {error:s}",
|
||||||
|
"error_changing_file_permissions": "Erro ao alterar as permissões para {path:s}: {error:s}",
|
||||||
|
"invalid_url": "URL inválida {url:s} (does this site exists ?)",
|
||||||
|
"download_ssl_error": "Erro de SSL ao conectar-se a {url:s}",
|
||||||
|
"download_timeout": "{url:s} demorou muito para responder, desistiu.",
|
||||||
|
"download_unknown_error": "Erro quando baixando os dados de {url:s} : {error:s}",
|
||||||
|
"download_bad_status_code": "{url:s} retornou o código de status {code:s}",
|
||||||
|
"command_unknown": "Comando '{command:s}' desconhecido ?"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import os
|
import os
|
||||||
|
import yaml
|
||||||
import errno
|
import errno
|
||||||
import shutil
|
import shutil
|
||||||
import json
|
import json
|
||||||
|
@ -64,6 +65,28 @@ def read_json(file_path):
|
||||||
return loaded_json
|
return loaded_json
|
||||||
|
|
||||||
|
|
||||||
|
def read_yaml(file_path):
|
||||||
|
"""
|
||||||
|
Safely read a yaml file
|
||||||
|
|
||||||
|
Keyword argument:
|
||||||
|
file_path -- Path to the yaml file
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Read file
|
||||||
|
file_content = read_file(file_path)
|
||||||
|
|
||||||
|
# Try to load yaml to check if it's syntaxically correct
|
||||||
|
try:
|
||||||
|
loaded_yaml = yaml.safe_load(file_content)
|
||||||
|
except ValueError as e:
|
||||||
|
raise MoulinetteError(errno.EINVAL,
|
||||||
|
m18n.g('corrupted_yaml',
|
||||||
|
ressource=file_path, error=str(e)))
|
||||||
|
|
||||||
|
return loaded_yaml
|
||||||
|
|
||||||
|
|
||||||
def write_to_file(file_path, data, file_mode="w"):
|
def write_to_file(file_path, data, file_mode="w"):
|
||||||
"""
|
"""
|
||||||
Write a single string or a list of string to a text file.
|
Write a single string or a list of string to a text file.
|
||||||
|
|
Loading…
Add table
Reference in a new issue