Exemple #1
0
def do_alarm_create(cc, args={}):
    '''Create a new alarm (Deprecated). Use alarm-threshold-create instead.'''
    fields = dict(filter(lambda x: not (x[1] is None), vars(args).items()))
    fields = utils.args_array_to_list_of_dicts(fields, "time_constraints")
    fields = utils.args_array_to_dict(fields, "matching_metadata")
    alarm = cc.alarms.create(**fields)
    _display_alarm(alarm)
def do_alarm_create(cc, args={}):
    '''Create a new alarm (Deprecated). Use alarm-threshold-create instead.'''
    fields = dict(filter(lambda x: not (x[1] is None), vars(args).items()))
    fields = utils.args_array_to_list_of_dicts(fields, "time_constraints")
    fields = utils.args_array_to_dict(fields, "matching_metadata")
    alarm = cc.alarms.create(**fields)
    _display_alarm(alarm)
def do_alarm_update(cc, args={}):
    '''Update an existing alarm.'''
    fields = dict(filter(lambda x: not (x[1] is None), vars(args).items()))
    fields = utils.args_array_to_dict(fields, "matching_metadata")
    fields.pop('alarm_id')
    alarm = cc.alarms.update(args.alarm_id, **fields)
    _display_alarm(alarm)
Exemple #4
0
def do_alarm_update(cc, args={}):
    '''Update an existing alarm.'''
    fields = dict(filter(lambda x: not (x[1] is None), vars(args).items()))
    fields = utils.args_array_to_dict(fields, "matching_metadata")
    fields.pop('alarm_id')
    alarm = cc.alarms.update(args.alarm_id, **fields)
    _display_alarm(alarm)
def do_alarm_update(cc, args={}):
    '''Update an existing alarm.'''
    fields = dict(filter(lambda x: not (x[1] is None), vars(args).items()))
    fields = utils.args_array_to_dict(fields, "matching_metadata")
    fields.pop('alarm_id')
    try:
        alarm = cc.alarms.update(args.alarm_id, **fields)
    except exc.HTTPNotFound:
        raise exc.CommandError('Alarm not found: %s' % args.alarm_id)
    _display_alarm(alarm)
Exemple #6
0
def do_alarm_update(cc, args={}):
    '''Update an existing alarm.'''
    fields = dict(filter(lambda x: not (x[1] is None), vars(args).items()))
    fields = utils.args_array_to_dict(fields, "matching_metadata")
    fields.pop('alarm_id')
    try:
        alarm = cc.alarms.update(args.alarm_id, **fields)
    except exc.HTTPNotFound:
        raise exc.CommandError('Alarm not found: %s' % args.alarm_id)
    _display_alarm(alarm)
 def test_args_array_to_dict(self):
     my_args = {
         'matching_metadata': ['metadata.key=metadata_value'],
         'other': 'value'
     }
     cleaned_dict = utils.args_array_to_dict(my_args,
                                             "matching_metadata")
     self.assertEqual({
         'matching_metadata': {'metadata.key': 'metadata_value'},
         'other': 'value'
     }, cleaned_dict)
Exemple #8
0
 def test_args_array_to_dict(self):
     my_args = {
         'matching_metadata': ['metadata.key=metadata_value'],
         'other': 'value'
     }
     cleaned_dict = utils.args_array_to_dict(my_args,
                                             "matching_metadata")
     self.assertEqual(cleaned_dict, {
         'matching_metadata': {'metadata.key': 'metadata_value'},
         'other': 'value'
     })
Exemple #9
0
def do_alarm_update(cc, args={}):
    """Update an existing alarm (Deprecated)."""
    fields = dict(filter(lambda x: not (x[1] is None), vars(args).items()))
    fields = utils.args_array_to_list_of_dicts(fields, "time_constraints")
    fields = utils.args_array_to_dict(fields, "matching_metadata")
    fields.pop("alarm_id")
    try:
        alarm = cc.alarms.update(args.alarm_id, **fields)
    except exc.HTTPNotFound:
        raise exc.CommandError("Alarm not found: %s" % args.alarm_id)
    _display_alarm(alarm)
Exemple #10
0
 def test_args_array_to_dict(self):
     my_args = {"matching_metadata": ["metadata.key=metadata_value"], "other": "value"}
     cleaned_dict = utils.args_array_to_dict(my_args, "matching_metadata")
     self.assertEqual(cleaned_dict, {"matching_metadata": {"metadata.key": "metadata_value"}, "other": "value"})
def do_alarm_create(cc, args={}):
    '''Create a new alarm (Deprecated).'''
    fields = dict(filter(lambda x: not (x[1] is None), vars(args).items()))
    fields = utils.args_array_to_dict(fields, "matching_metadata")
    alarm = cc.alarms.create(**fields)
    _display_alarm(alarm)
Exemple #12
0
def do_alarm_create(cc, args={}):
    '''Create a new alarm (Deprecated).'''
    fields = dict(filter(lambda x: not (x[1] is None), vars(args).items()))
    fields = utils.args_array_to_dict(fields, "matching_metadata")
    alarm = cc.alarms.create(**fields)
    _display_alarm(alarm)