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
|
api: PUT /backups/<name>/restore
|
||||||
arguments:
|
arguments:
|
||||||
name:
|
name:
|
||||||
help: Name of the local backup archive
|
help: Name or path of the backup archive
|
||||||
--system:
|
--system:
|
||||||
help: List of system parts to restore (or all if none is given)
|
help: List of system parts to restore (or all if none is given)
|
||||||
nargs: "*"
|
nargs: "*"
|
||||||
|
@ -1232,7 +1232,7 @@ backup:
|
||||||
api: GET /backups/<name>
|
api: GET /backups/<name>
|
||||||
arguments:
|
arguments:
|
||||||
name:
|
name:
|
||||||
help: Name of the local backup archive
|
help: Name or path of the backup archive
|
||||||
-d:
|
-d:
|
||||||
full: --with-details
|
full: --with-details
|
||||||
help: Show additional backup information
|
help: Show additional backup information
|
||||||
|
|
|
@ -2314,11 +2314,6 @@ def backup_restore(name, system=[], apps=[], force=False):
|
||||||
# Initialize #
|
# 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 = RestoreManager(name)
|
||||||
|
|
||||||
restore_manager.set_system_targets(system)
|
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
|
human_readable -- Print sizes in human readable format
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
original_name = name
|
||||||
|
|
||||||
if name.endswith(".tar.gz"):
|
if name.endswith(".tar.gz"):
|
||||||
name = name[: -len(".tar.gz")]
|
name = name[: -len(".tar.gz")]
|
||||||
|
@ -2462,6 +2458,9 @@ def backup_info(name, with_details=False, human_readable=False):
|
||||||
# Check file exist (even if it's a broken symlink)
|
# Check file exist (even if it's a broken symlink)
|
||||||
if not os.path.lexists(archive_file):
|
if not os.path.lexists(archive_file):
|
||||||
archive_file += ".gz"
|
archive_file += ".gz"
|
||||||
|
if not os.path.lexists(archive_file):
|
||||||
|
# Maybe the user provided a path to the backup?
|
||||||
|
archive_file = original_name
|
||||||
if not os.path.lexists(archive_file):
|
if not os.path.lexists(archive_file):
|
||||||
raise YunohostValidationError("backup_archive_name_unknown", name=name)
|
raise YunohostValidationError("backup_archive_name_unknown", name=name)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue