Skip to content
Snippets Groups Projects
Commit 19754e95 authored by Aaron Johnson's avatar Aaron Johnson
Browse files

added no-archive feature

parent 1be39b41
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. ...@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.0] - 2020-07-16 ## [1.0.0] - 2020-07-23
### Added ### Added
- add setup.py - add setup.py
...@@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- grafanaSettings can now be parameterized via an external json config file (~/.grafana-backup.json) - grafanaSettings can now be parameterized via an external json config file (~/.grafana-backup.json)
- refactored backup/restore shell scripts - refactored backup/restore shell scripts
- individual components can be backed up using console_script - individual components can be backed up using console_script
- archiving of backup can now be skipped using --no-archive
### Removed ### Removed
- delete Pipenv - delete Pipenv
......
...@@ -9,7 +9,7 @@ docstring = """ ...@@ -9,7 +9,7 @@ docstring = """
{0} {1} {0} {1}
Usage: Usage:
grafana-backup save [--config=<filename>] [--components=<folders,dashboards,datasources,alert-channels>] grafana-backup save [--config=<filename>] [--components=<folders,dashboards,datasources,alert-channels>] [--no-archive]
grafana-backup restore <archive_file> [--config=<filename>] grafana-backup restore <archive_file> [--config=<filename>]
grafana-backup [--config=<filename>] grafana-backup [--config=<filename>]
grafana-backup -h | --help grafana-backup -h | --help
...@@ -21,6 +21,7 @@ Options: ...@@ -21,6 +21,7 @@ Options:
--config=<filename> Override default configuration path --config=<filename> Override default configuration path
--components=<folders,dashboards,datasources,alert-channels> Comma separated list of individual components to backup --components=<folders,dashboards,datasources,alert-channels> Comma separated list of individual components to backup
rather than backing up all components by default rather than backing up all components by default
--no-archive Skip archive creation and do not delete unarchived files
""".format(PKG_NAME, PKG_VERSION) """.format(PKG_NAME, PKG_VERSION)
args = docopt(docstring, version='{0} {1}'.format(PKG_NAME, PKG_VERSION)) args = docopt(docstring, version='{0} {1}'.format(PKG_NAME, PKG_VERSION))
......
...@@ -7,6 +7,7 @@ from grafana_backup.archive import main as archive ...@@ -7,6 +7,7 @@ from grafana_backup.archive import main as archive
def main(args, settings): def main(args, settings):
arg_components = args.get('--components', False) arg_components = args.get('--components', False)
arg_no_archive = args.get('--no-archive', False)
backup_functions = { 'dashboards': save_dashboards, backup_functions = { 'dashboards': save_dashboards,
'datasources': save_datasources, 'datasources': save_datasources,
...@@ -23,4 +24,5 @@ def main(args, settings): ...@@ -23,4 +24,5 @@ def main(args, settings):
for backup_function in backup_functions.keys(): for backup_function in backup_functions.keys():
backup_functions[backup_function](args, settings) backup_functions[backup_function](args, settings)
archive(args, settings) if not arg_no_archive:
archive(args, settings)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment