Switch some functions with many arguments to kwargs only.
This commit is contained in:
parent
af7caec509
commit
e4d1b49c39
2 changed files with 21 additions and 12 deletions
|
@ -144,7 +144,15 @@ def run_configuration(config_filename, args): # pragma: no cover
|
||||||
if args.create:
|
if args.create:
|
||||||
hook.execute_hook(hooks.get('before_backup'), config_filename, 'pre-backup')
|
hook.execute_hook(hooks.get('before_backup'), config_filename, 'pre-backup')
|
||||||
|
|
||||||
_run_commands(args, consistency, local_path, location, remote_path, retention, storage)
|
_run_commands(
|
||||||
|
args=args,
|
||||||
|
consistency=consistency,
|
||||||
|
local_pagh=local_path,
|
||||||
|
location=location,
|
||||||
|
remote_path=remote_path,
|
||||||
|
retention=retention,
|
||||||
|
storage=storage,
|
||||||
|
)
|
||||||
|
|
||||||
if args.create:
|
if args.create:
|
||||||
hook.execute_hook(hooks.get('after_backup'), config_filename, 'post-backup')
|
hook.execute_hook(hooks.get('after_backup'), config_filename, 'post-backup')
|
||||||
|
@ -153,25 +161,26 @@ def run_configuration(config_filename, args): # pragma: no cover
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
def _run_commands(args, consistency, local_path, location, remote_path, retention, storage):
|
def _run_commands(*, args, consistency, local_path, location, remote_path, retention, storage):
|
||||||
json_results = []
|
json_results = []
|
||||||
for unexpanded_repository in location['repositories']:
|
for unexpanded_repository in location['repositories']:
|
||||||
_run_commands_on_repository(
|
_run_commands_on_repository(
|
||||||
args,
|
args=args,
|
||||||
consistency,
|
consistency=consistency,
|
||||||
json_results,
|
json_results=json_results,
|
||||||
local_path,
|
local_path=local_path,
|
||||||
location,
|
location=location,
|
||||||
remote_path,
|
remote_path=remote_path,
|
||||||
retention,
|
retention=retention,
|
||||||
storage,
|
storage=storage,
|
||||||
unexpanded_repository,
|
unexpanded_repository=unexpanded_repository,
|
||||||
)
|
)
|
||||||
if args.json:
|
if args.json:
|
||||||
sys.stdout.write(json.dumps(json_results))
|
sys.stdout.write(json.dumps(json_results))
|
||||||
|
|
||||||
|
|
||||||
def _run_commands_on_repository(
|
def _run_commands_on_repository(
|
||||||
|
*,
|
||||||
args,
|
args,
|
||||||
consistency,
|
consistency,
|
||||||
json_results,
|
json_results,
|
||||||
|
|
|
@ -6,7 +6,7 @@ from flexmock import flexmock
|
||||||
from borgmatic.commands import borgmatic
|
from borgmatic.commands import borgmatic
|
||||||
|
|
||||||
|
|
||||||
def test__run_commands_handles_multiple_json_outputs_in_array():
|
def test_run_commands_handles_multiple_json_outputs_in_array():
|
||||||
(
|
(
|
||||||
flexmock(borgmatic)
|
flexmock(borgmatic)
|
||||||
.should_receive('_run_commands_on_repository')
|
.should_receive('_run_commands_on_repository')
|
||||||
|
|
Loading…
Reference in a new issue