--skip-monitoring flag
Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
This commit is contained in:
parent
1ee3b89e99
commit
6ce6367a26
|
@ -145,6 +145,13 @@ def make_parsers():
|
|||
action='store_true',
|
||||
help='Go through the motions, but do not actually write to any repositories',
|
||||
)
|
||||
global_group.add_argument(
|
||||
'-nm',
|
||||
'--skip-monitoring',
|
||||
dest='skip_monitoring',
|
||||
action='store_true',
|
||||
help='Skip reporting any data to the configured monitoring services',
|
||||
)
|
||||
global_group.add_argument(
|
||||
'-nc', '--no-color', dest='no_color', action='store_true', help='Disable colored output'
|
||||
)
|
||||
|
|
|
@ -67,6 +67,12 @@ def run_configuration(config_filename, config, arguments):
|
|||
using_primary_action = {'create', 'prune', 'compact', 'check'}.intersection(arguments)
|
||||
monitoring_log_level = verbosity_to_log_level(global_arguments.monitoring_verbosity)
|
||||
action_name = next(iter(arguments))
|
||||
skip_monitoring = global_arguments.skip_monitoring
|
||||
|
||||
# action_names = [action for action in arguments.keys() if action != 'global' and isinstance(action, str)]
|
||||
|
||||
# print (action_names)
|
||||
# return
|
||||
|
||||
try:
|
||||
local_borg_version = borg_version.local_borg_version(storage, local_path)
|
||||
|
@ -75,7 +81,7 @@ def run_configuration(config_filename, config, arguments):
|
|||
return
|
||||
|
||||
try:
|
||||
if using_primary_action:
|
||||
if using_primary_action and not skip_monitoring:
|
||||
dispatch.call_hooks(
|
||||
'initialize_monitor',
|
||||
hooks,
|
||||
|
@ -84,7 +90,7 @@ def run_configuration(config_filename, config, arguments):
|
|||
monitoring_log_level,
|
||||
global_arguments.dry_run,
|
||||
)
|
||||
if using_primary_action:
|
||||
if using_primary_action and not skip_monitoring:
|
||||
dispatch.call_hooks(
|
||||
'ping_monitor',
|
||||
hooks,
|
||||
|
@ -153,7 +159,7 @@ def run_configuration(config_filename, config, arguments):
|
|||
error_repository = repository_path
|
||||
|
||||
try:
|
||||
if using_primary_action:
|
||||
if using_primary_action and not skip_monitoring:
|
||||
# send logs irrespective of error
|
||||
dispatch.call_hooks(
|
||||
'ping_monitor',
|
||||
|
@ -174,7 +180,7 @@ def run_configuration(config_filename, config, arguments):
|
|||
|
||||
if not encountered_error:
|
||||
try:
|
||||
if using_primary_action:
|
||||
if using_primary_action and not skip_monitoring:
|
||||
dispatch.call_hooks(
|
||||
'ping_monitor',
|
||||
hooks,
|
||||
|
|
Loading…
Reference in New Issue