summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyota MIBU <r-mibu@cq.jp.nec.com>2015-08-23 22:04:57 +0900
committerRyota MIBU <r-mibu@cq.jp.nec.com>2015-09-08 12:42:09 +0900
commit9d76c8e94ece2cd027120e93f8036e6d0a67021d (patch)
tree1236eeb2c0a53e91663813eb15c56e8dc8c3cb11
parentb9f14c262092891e62d13a80b86708b28cd9db87 (diff)
downloadpython-ceilometerclient-9d76c8e94ece2cd027120e93f8036e6d0a67021d.tar.gz
refactor: move 'repeat_actions' to common args
Change-Id: I53f3af447a8f814388985f6e4ab57a8ffec18a2a
-rw-r--r--ceilometerclient/v2/shell.py42
1 files changed, 5 insertions, 37 deletions
diff --git a/ceilometerclient/v2/shell.py b/ceilometerclient/v2/shell.py
index 9879c12..3bf4131 100644
--- a/ceilometerclient/v2/shell.py
+++ b/ceilometerclient/v2/shell.py
@@ -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={}):