Compare commits

...

2 Commits

Author SHA1 Message Date
  Florian Lindner c57abcfda6 Pretty format json output. 2 years ago
  Florian Lindner c4792aebb0 Implement json output for create_archive. 2 years ago
2 changed files with 9 additions and 3 deletions
Split View
  1. +2
    -1
      borgmatic/borg/create.py
  2. +7
    -2
      borgmatic/commands/borgmatic.py

+ 2
- 1
borgmatic/borg/create.py View File

@@ -157,4 +157,5 @@ def create_archive(
)

logger.debug(' '.join(full_command))
subprocess.check_call(full_command)
output = subprocess.check_output(full_command)
return output.decode() if output is not None else None

+ 7
- 2
borgmatic/commands/borgmatic.py View File

@@ -155,7 +155,7 @@ def _run_commands(args, consistency, local_path, location, remote_path, retentio
unexpanded_repository,
)
if args.json:
sys.stdout.write(json.dumps(json_results))
sys.stdout.write(json.dumps(json_results, indent=2))


def _run_commands_on_repository(
@@ -176,14 +176,19 @@ def _run_commands_on_repository(
)
if args.create:
logger.info('{}: Creating archive{}'.format(repository, dry_run_label))
borg_create.create_archive(
output = borg_create.create_archive(
args.dry_run,
repository,
location,
storage,
local_path=local_path,
remote_path=remote_path,
json=args.json,
)
if args.json:
json_results.append(json.loads(output))
else:
sys.stdout.write(output)
if args.check:
logger.info('{}: Running consistency checks'.format(repository))
borg_check.check_archives(


Loading…
Cancel
Save