def do_alarm_definition_update(mc, args):
    '''Update the alarm definition.'''
    fields = {}
    fields['alarm_id'] = args.id
    fields['name'] = args.name
    fields['description'] = args.description
    fields['expression'] = args.expression
    fields['alarm_actions'] = _arg_split_patch_update(args.alarm_actions)
    fields['ok_actions'] = _arg_split_patch_update(args.ok_actions)
    fields['undetermined_actions'] = _arg_split_patch_update(args.undetermined_actions)
    if args.actions_enabled not in enabled_types:
        errmsg = ('Invalid value, not one of [' +
                  ', '.join(enabled_types) + ']')
        print(errmsg)
        return
    fields['actions_enabled'] = args.actions_enabled in ['true', 'True']
    fields['match_by'] = _arg_split_patch_update(args.match_by)
    if not _validate_severity(args.severity):
        return
    fields['severity'] = args.severity
    try:
        alarm = mc.alarm_definitions.update(**fields)
    except (osc_exc.ClientException, k_exc.HttpError) as he:
        raise osc_exc.CommandError('%s\n%s' % (he.message, he.details))
    else:
        print(jsonutils.dumps(alarm, indent=2))
def do_alarm_definition_update ( mc , args ) : fields = { } fields [ 'alarm_id' ] = args . id fields [ 'name' ] = args . name fields [ 'description' ] = args . description fields [ 'expression' ] = args . expression fields [ 'alarm_actions' ] = _arg_split_patch_update ( args . alarm_actions ) fields [ 'ok_actions' ] = _arg_split_patch_update ( args . ok_actions ) fields [ 'undetermined_actions' ] = _arg_split_patch_update ( args . undetermined_actions ) if args . actions_enabled not in enabled_types : errmsg = ( 'Invalid value, not one of [' + ', ' . join ( enabled_types ) + ']' ) print ( errmsg ) return fields [ 'actions_enabled' ] = args . actions_enabled in [ 'true' , 'True' ] fields [ 'match_by' ] = _arg_split_patch_update ( args . match_by ) if not _validate_severity ( args . severity ) : return fields [ 'severity' ] = args . severity try : alarm = mc . alarm_definitions . update ( ** fields ) except ( osc_exc . ClientException , k_exc . HttpError ) as he : raise osc_exc . CommandError ( '%s\n%s' % ( he . message , he . details ) ) else : print ( jsonutils . dumps ( alarm , indent = 2 ) )
Update the alarm definition.