refactor: move 'repeat_actions' to common args
Change-Id: I53f3af447a8f814388985f6e4ab57a8ffec18a2a
This commit is contained in:
@@ -482,6 +482,11 @@ def common_alarm_arguments(create=False):
|
||||
'name=<CONSTRAINT_NAME>;start=<CRON>;'
|
||||
'duration=<SECONDS>;[description=<DESCRIPTION>;'
|
||||
'[timezone=<IANA Timezone>]]'))
|
||||
@utils.arg('--repeat-actions', dest='repeat_actions',
|
||||
metavar='{True|False}', type=strutils.bool_from_string,
|
||||
default=False,
|
||||
help=('True if actions should be repeatedly notified '
|
||||
'while alarm remains in target state.'))
|
||||
@functools.wraps(func)
|
||||
def _wrapped(*args, **kwargs):
|
||||
return func(*args, **kwargs)
|
||||
@@ -509,11 +514,6 @@ def common_alarm_gnocchi_arguments(rule_namespace, create=False):
|
||||
dest=rule_namespace + '/threshold',
|
||||
required=create,
|
||||
help='Threshold to evaluate against.')
|
||||
@utils.arg('--repeat-actions', dest='repeat_actions',
|
||||
metavar='{True|False}', type=strutils.bool_from_string,
|
||||
default=False,
|
||||
help=('True if actions should be repeatedly notified '
|
||||
'while alarm remains in target state.'))
|
||||
@functools.wraps(func)
|
||||
def _wrapped(*args, **kwargs):
|
||||
return func(*args, **kwargs)
|
||||
@@ -589,11 +589,6 @@ def common_alarm_event_arguments():
|
||||
help=('key[op]data_type::value; list for filtering events. '
|
||||
'data_type is optional, but if supplied must be '
|
||||
'string, integer, float or datetime.'))
|
||||
@utils.arg('--repeat-actions', dest='repeat_actions',
|
||||
metavar='{True|False}', type=strutils.bool_from_string,
|
||||
default=False,
|
||||
help=('True if actions should be repeatedly notified '
|
||||
'while alarm remains in target state.'))
|
||||
@functools.wraps(func)
|
||||
def _wrapped(*args, **kwargs):
|
||||
return func(*args, **kwargs)
|
||||
@@ -619,11 +614,6 @@ def common_alarm_event_arguments():
|
||||
metavar='<Matching Metadata>', action='append', default=None,
|
||||
help=('A meter should match this resource metadata (key=value) '
|
||||
'additionally to the meter_name.'))
|
||||
@utils.arg('--repeat-actions', dest='repeat_actions',
|
||||
metavar='{True|False}', type=strutils.bool_from_string,
|
||||
default=False,
|
||||
help=('True if actions should be repeatedly notified '
|
||||
'while alarm remains in target state.'))
|
||||
@_restore_shadowed_arg('project_id', 'alarm_project_id')
|
||||
@_restore_shadowed_arg('user_id', 'alarm_user_id')
|
||||
def do_alarm_create(cc, args={}):
|
||||
@@ -701,11 +691,6 @@ def do_alarm_gnocchi_aggregation_by_resources_threshold_create(cc, args={}):
|
||||
dest='threshold_rule/query',
|
||||
help='key[op]data_type::value; list. data_type is optional, '
|
||||
'but if supplied must be string, integer, float, or boolean.')
|
||||
@utils.arg('--repeat-actions', dest='repeat_actions',
|
||||
metavar='{True|False}', type=strutils.bool_from_string,
|
||||
default=False,
|
||||
help=('True if actions should be repeatedly notified '
|
||||
'while alarm remains in target state.'))
|
||||
@_restore_shadowed_arg('project_id', 'alarm_project_id')
|
||||
@_restore_shadowed_arg('user_id', 'alarm_user_id')
|
||||
def do_alarm_threshold_create(cc, args={}):
|
||||
@@ -729,11 +714,6 @@ def do_alarm_threshold_create(cc, args={}):
|
||||
dest='combination_rule/operator',
|
||||
help='Operator to compare with, one of: ' + str(
|
||||
ALARM_COMBINATION_OPERATORS) + '.')
|
||||
@utils.arg('--repeat-actions', dest='repeat_actions',
|
||||
metavar='{True|False}', type=strutils.bool_from_string,
|
||||
default=False,
|
||||
help=('True if actions should be repeatedly notified '
|
||||
'while alarm remains in target state.'))
|
||||
@_restore_shadowed_arg('project_id', 'alarm_project_id')
|
||||
@_restore_shadowed_arg('user_id', 'alarm_user_id')
|
||||
def do_alarm_combination_create(cc, args={}):
|
||||
@@ -790,10 +770,6 @@ def do_alarm_event_create(cc, args={}):
|
||||
metavar='<Matching Metadata>', action='append', default=None,
|
||||
help=('A meter should match this resource metadata (key=value) '
|
||||
'additionally to the meter_name.'))
|
||||
@utils.arg('--repeat-actions', dest='repeat_actions',
|
||||
metavar='{True|False}', type=strutils.bool_from_string,
|
||||
help=('True if actions should be repeatedly notified '
|
||||
'while alarm remains in target state.'))
|
||||
@_restore_shadowed_arg('project_id', 'alarm_project_id')
|
||||
@_restore_shadowed_arg('user_id', 'alarm_user_id')
|
||||
def do_alarm_update(cc, args={}):
|
||||
@@ -843,10 +819,6 @@ def do_alarm_update(cc, args={}):
|
||||
dest='threshold_rule/query',
|
||||
help='key[op]data_type::value; list. data_type is optional, '
|
||||
'but if supplied must be string, integer, float, or boolean.')
|
||||
@utils.arg('--repeat-actions', dest='repeat_actions',
|
||||
metavar='{True|False}', type=strutils.bool_from_string,
|
||||
help=('True if actions should be repeatedly notified '
|
||||
'while alarm remains in target state.'))
|
||||
@_restore_shadowed_arg('project_id', 'alarm_project_id')
|
||||
@_restore_shadowed_arg('user_id', 'alarm_user_id')
|
||||
def do_alarm_threshold_update(cc, args={}):
|
||||
@@ -963,10 +935,6 @@ def do_alarm_gnocchi_aggregation_by_resources_threshold_update(cc, args={}):
|
||||
dest='combination_rule/operator',
|
||||
help='Operator to compare with, one of: ' + str(
|
||||
ALARM_COMBINATION_OPERATORS) + '.')
|
||||
@utils.arg('--repeat-actions', dest='repeat_actions',
|
||||
metavar='{True|False}', type=strutils.bool_from_string,
|
||||
help=('True if actions should be repeatedly notified '
|
||||
'while alarm remains in target state.'))
|
||||
@_restore_shadowed_arg('project_id', 'alarm_project_id')
|
||||
@_restore_shadowed_arg('user_id', 'alarm_user_id')
|
||||
def do_alarm_combination_update(cc, args={}):
|
||||
|
||||
Reference in New Issue
Block a user