[enh] Add optionnal 'description' info to the backup archive

This commit is contained in:
Jérôme Lebleu 2014-11-06 02:49:22 +01:00
parent fdb51ac200
commit fd8e3d3d0a
2 changed files with 7 additions and 1 deletions

View file

@ -571,6 +571,9 @@ backup:
pattern:
- '^[\w\-\.]{1,30}(?<!\.)$'
- pattern_backup_archive_name
-d:
full: --description
help: Short description of the backup
--ignore-apps:
help: Do not backup apps
action: store_true

View file

@ -40,12 +40,13 @@ archives_path = '%s/archives' % backup_path
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
Keyword arguments:
name -- Name of the backup archive
description -- Short description of the backup
ignore_apps -- Do not backup apps
"""
@ -61,6 +62,7 @@ def backup_create(name=None, ignore_apps=False):
# Initialize backup info
info = {
'description': description or '',
'created_at': timestamp,
'apps': {},
}
@ -286,5 +288,6 @@ def backup_info(name):
'path': archive_file,
'created_at': time.strftime(m18n.n('format_datetime_short'),
time.gmtime(info['created_at'])),
'description': info['description'],
'apps': info['apps'],
}