list_archives()
unconditionally returns the output value
(regardless of JSON or not)
This commit is contained in:
parent
8e14846872
commit
76b5953959
|
@ -32,9 +32,4 @@ def list_archives(verbosity, repository, storage_config, local_path='borg', remo
|
||||||
with tempfile.TemporaryFile() as f_output:
|
with tempfile.TemporaryFile() as f_output:
|
||||||
subprocess.check_call(full_command, stdout=f_output)
|
subprocess.check_call(full_command, stdout=f_output)
|
||||||
f_output.seek(0)
|
f_output.seek(0)
|
||||||
output = f_output.read().decode()
|
return f_output.read().decode()
|
||||||
|
|
||||||
if json:
|
|
||||||
return output
|
|
||||||
else:
|
|
||||||
sys.stdout.write(output)
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ def run_configuration(config_filename, args): # pragma: no cover
|
||||||
)
|
)
|
||||||
if args.list:
|
if args.list:
|
||||||
logger.info('{}: Listing archives'.format(repository))
|
logger.info('{}: Listing archives'.format(repository))
|
||||||
result = borg_list.list_archives(
|
output = borg_list.list_archives(
|
||||||
args.verbosity,
|
args.verbosity,
|
||||||
repository,
|
repository,
|
||||||
storage,
|
storage,
|
||||||
|
@ -178,7 +178,9 @@ def run_configuration(config_filename, args): # pragma: no cover
|
||||||
json=args.json,
|
json=args.json,
|
||||||
)
|
)
|
||||||
if args.json:
|
if args.json:
|
||||||
json_results.append(json.loads(result))
|
json_results.append(json.loads(output))
|
||||||
|
else:
|
||||||
|
sys.stdout.write(output)
|
||||||
if args.info:
|
if args.info:
|
||||||
logger.info('{}: Displaying summary info for archives'.format(repository))
|
logger.info('{}: Displaying summary info for archives'.format(repository))
|
||||||
borg_info.display_archives_info(
|
borg_info.display_archives_info(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user