--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',
|
action='store_true',
|
||||||
help='Go through the motions, but do not actually write to any repositories',
|
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(
|
global_group.add_argument(
|
||||||
'-nc', '--no-color', dest='no_color', action='store_true', help='Disable colored output'
|
'-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)
|
using_primary_action = {'create', 'prune', 'compact', 'check'}.intersection(arguments)
|
||||||
monitoring_log_level = verbosity_to_log_level(global_arguments.monitoring_verbosity)
|
monitoring_log_level = verbosity_to_log_level(global_arguments.monitoring_verbosity)
|
||||||
action_name = next(iter(arguments))
|
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:
|
try:
|
||||||
local_borg_version = borg_version.local_borg_version(storage, local_path)
|
local_borg_version = borg_version.local_borg_version(storage, local_path)
|
||||||
|
@ -75,7 +81,7 @@ def run_configuration(config_filename, config, arguments):
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if using_primary_action:
|
if using_primary_action and not skip_monitoring:
|
||||||
dispatch.call_hooks(
|
dispatch.call_hooks(
|
||||||
'initialize_monitor',
|
'initialize_monitor',
|
||||||
hooks,
|
hooks,
|
||||||
|
@ -84,7 +90,7 @@ def run_configuration(config_filename, config, arguments):
|
||||||
monitoring_log_level,
|
monitoring_log_level,
|
||||||
global_arguments.dry_run,
|
global_arguments.dry_run,
|
||||||
)
|
)
|
||||||
if using_primary_action:
|
if using_primary_action and not skip_monitoring:
|
||||||
dispatch.call_hooks(
|
dispatch.call_hooks(
|
||||||
'ping_monitor',
|
'ping_monitor',
|
||||||
hooks,
|
hooks,
|
||||||
|
@ -153,7 +159,7 @@ def run_configuration(config_filename, config, arguments):
|
||||||
error_repository = repository_path
|
error_repository = repository_path
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if using_primary_action:
|
if using_primary_action and not skip_monitoring:
|
||||||
# send logs irrespective of error
|
# send logs irrespective of error
|
||||||
dispatch.call_hooks(
|
dispatch.call_hooks(
|
||||||
'ping_monitor',
|
'ping_monitor',
|
||||||
|
@ -174,7 +180,7 @@ def run_configuration(config_filename, config, arguments):
|
||||||
|
|
||||||
if not encountered_error:
|
if not encountered_error:
|
||||||
try:
|
try:
|
||||||
if using_primary_action:
|
if using_primary_action and not skip_monitoring:
|
||||||
dispatch.call_hooks(
|
dispatch.call_hooks(
|
||||||
'ping_monitor',
|
'ping_monitor',
|
||||||
hooks,
|
hooks,
|
||||||
|
|
Loading…
Reference in New Issue