mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
backups: one should be able to restore a backup archive by providing a path to the archive without moving it to /home/yunohost.backup/archives/
This commit is contained in:
parent
8be726b993
commit
c8a18129df
2 changed files with 7 additions and 8 deletions
|
@ -1201,7 +1201,7 @@ backup:
|
|||
api: PUT /backups/<name>/restore
|
||||
arguments:
|
||||
name:
|
||||
help: Name of the local backup archive
|
||||
help: Name or path of the backup archive
|
||||
--system:
|
||||
help: List of system parts to restore (or all if none is given)
|
||||
nargs: "*"
|
||||
|
@ -1232,7 +1232,7 @@ backup:
|
|||
api: GET /backups/<name>
|
||||
arguments:
|
||||
name:
|
||||
help: Name of the local backup archive
|
||||
help: Name or path of the backup archive
|
||||
-d:
|
||||
full: --with-details
|
||||
help: Show additional backup information
|
||||
|
|
|
@ -2314,11 +2314,6 @@ def backup_restore(name, system=[], apps=[], force=False):
|
|||
# Initialize #
|
||||
#
|
||||
|
||||
if name.endswith(".tar.gz"):
|
||||
name = name[: -len(".tar.gz")]
|
||||
elif name.endswith(".tar"):
|
||||
name = name[: -len(".tar")]
|
||||
|
||||
restore_manager = RestoreManager(name)
|
||||
|
||||
restore_manager.set_system_targets(system)
|
||||
|
@ -2451,6 +2446,7 @@ def backup_info(name, with_details=False, human_readable=False):
|
|||
human_readable -- Print sizes in human readable format
|
||||
|
||||
"""
|
||||
original_name = name
|
||||
|
||||
if name.endswith(".tar.gz"):
|
||||
name = name[: -len(".tar.gz")]
|
||||
|
@ -2463,7 +2459,10 @@ def backup_info(name, with_details=False, human_readable=False):
|
|||
if not os.path.lexists(archive_file):
|
||||
archive_file += ".gz"
|
||||
if not os.path.lexists(archive_file):
|
||||
raise YunohostValidationError("backup_archive_name_unknown", name=name)
|
||||
# Maybe the user provided a path to the backup?
|
||||
archive_file = original_name
|
||||
if not os.path.lexists(archive_file):
|
||||
raise YunohostValidationError("backup_archive_name_unknown", name=name)
|
||||
|
||||
# If symlink, retrieve the real path
|
||||
if os.path.islink(archive_file):
|
||||
|
|
Loading…
Add table
Reference in a new issue