mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Add optionnal 'description' info to the backup archive
This commit is contained in:
parent
fdb51ac200
commit
fd8e3d3d0a
2 changed files with 7 additions and 1 deletions
|
@ -571,6 +571,9 @@ backup:
|
||||||
pattern:
|
pattern:
|
||||||
- '^[\w\-\.]{1,30}(?<!\.)$'
|
- '^[\w\-\.]{1,30}(?<!\.)$'
|
||||||
- pattern_backup_archive_name
|
- pattern_backup_archive_name
|
||||||
|
-d:
|
||||||
|
full: --description
|
||||||
|
help: Short description of the backup
|
||||||
--ignore-apps:
|
--ignore-apps:
|
||||||
help: Do not backup apps
|
help: Do not backup apps
|
||||||
action: store_true
|
action: store_true
|
||||||
|
|
|
@ -40,12 +40,13 @@ archives_path = '%s/archives' % backup_path
|
||||||
logger = getActionLogger('yunohost.backup')
|
logger = getActionLogger('yunohost.backup')
|
||||||
|
|
||||||
|
|
||||||
def backup_create(name=None, ignore_apps=False):
|
def backup_create(name=None, description=None, ignore_apps=False):
|
||||||
"""
|
"""
|
||||||
Create a backup local archive
|
Create a backup local archive
|
||||||
|
|
||||||
Keyword arguments:
|
Keyword arguments:
|
||||||
name -- Name of the backup archive
|
name -- Name of the backup archive
|
||||||
|
description -- Short description of the backup
|
||||||
ignore_apps -- Do not backup apps
|
ignore_apps -- Do not backup apps
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -61,6 +62,7 @@ def backup_create(name=None, ignore_apps=False):
|
||||||
|
|
||||||
# Initialize backup info
|
# Initialize backup info
|
||||||
info = {
|
info = {
|
||||||
|
'description': description or '',
|
||||||
'created_at': timestamp,
|
'created_at': timestamp,
|
||||||
'apps': {},
|
'apps': {},
|
||||||
}
|
}
|
||||||
|
@ -286,5 +288,6 @@ def backup_info(name):
|
||||||
'path': archive_file,
|
'path': archive_file,
|
||||||
'created_at': time.strftime(m18n.n('format_datetime_short'),
|
'created_at': time.strftime(m18n.n('format_datetime_short'),
|
||||||
time.gmtime(info['created_at'])),
|
time.gmtime(info['created_at'])),
|
||||||
|
'description': info['description'],
|
||||||
'apps': info['apps'],
|
'apps': info['apps'],
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue