mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Add logging to backup_create
This commit is contained in:
parent
86f22d1b46
commit
fe9f0731e8
2 changed files with 11 additions and 1 deletions
|
@ -375,6 +375,7 @@
|
|||
"log_app_config_show_panel": "Show the config panel of the '{}' app",
|
||||
"log_app_config_apply": "Apply config to the '{}' app",
|
||||
"log_available_on_yunopaste": "This log is now available via {url}",
|
||||
"log_backup_create": "Create a backup archive",
|
||||
"log_backup_restore_system": "Restore system from a backup archive",
|
||||
"log_backup_restore_app": "Restore '{}' from a backup archive",
|
||||
"log_remove_on_failed_restore": "Remove '{}' after a failed restore from a backup archive",
|
||||
|
|
|
@ -63,7 +63,7 @@ from yunohost.hook import (
|
|||
)
|
||||
from yunohost.tools import tools_postinstall, _tools_migrations_run_after_system_restore, _tools_migrations_run_before_app_restore
|
||||
from yunohost.regenconf import regen_conf
|
||||
from yunohost.log import OperationLogger
|
||||
from yunohost.log import OperationLogger, is_unit_operation
|
||||
from yunohost.utils.error import YunohostError, YunohostValidationError
|
||||
from yunohost.utils.packages import ynh_packages_version
|
||||
from yunohost.settings import settings_get
|
||||
|
@ -2135,7 +2135,9 @@ class CustomBackupMethod(BackupMethod):
|
|||
#
|
||||
|
||||
|
||||
@is_unit_operation()
|
||||
def backup_create(
|
||||
operation_logger,
|
||||
name=None, description=None, methods=[], output_directory=None, system=[], apps=[]
|
||||
):
|
||||
"""
|
||||
|
@ -2191,6 +2193,8 @@ def backup_create(
|
|||
# Intialize #
|
||||
#
|
||||
|
||||
operation_logger.start()
|
||||
|
||||
# Create yunohost archives directory if it does not exists
|
||||
_create_archive_dir()
|
||||
|
||||
|
@ -2205,6 +2209,10 @@ def backup_create(
|
|||
backup_manager.set_system_targets(system)
|
||||
backup_manager.set_apps_targets(apps)
|
||||
|
||||
for app in backup_manager.targets.list("apps", exclude=["Skipped"]):
|
||||
operation_logger.related_to.append(("app", app))
|
||||
operation_logger.flush()
|
||||
|
||||
#
|
||||
# Collect files and put them in the archive #
|
||||
#
|
||||
|
@ -2217,6 +2225,7 @@ def backup_create(
|
|||
backup_manager.backup()
|
||||
|
||||
logger.success(m18n.n("backup_created"))
|
||||
operation_logger.success()
|
||||
|
||||
return {
|
||||
"name": backup_manager.name,
|
||||
|
|
Loading…
Add table
Reference in a new issue