Comment 8 for bug 1799406

do_execute, line 508: cursor.execute(statement, parameters)

statement=UPDATE alarm SET alarm_id=%(alarm_id)s, enabled=%(enabled)s, name=%(name)s, type=%(type)s, severity=%(severity)s, description=%(description)s, timestamp=%(timestamp)s, user_id=%(user_id)s, project_id=%(project_id)s, state=%(state)s, state_reason=%(state_reason)s, state_timestamp=%(state_timestamp)s, ok_actions=%(ok_actions)s, alarm_actions=%(alarm_actions)s, insufficient_data_actions=%(insufficient_data_actions)s, repeat_actions=%(repeat_actions)s, rule=%(rule)s, time_constraints=%(time_constraints)s WHERE alarm.alarm_id = %(alarm_id_1)s

parameters={'alarm_id': 'cd47c788-58df-4604-b21e-565d4055f872', 'enabled': 1, 'name': 'cpu_1', 'type': 'event', 'severity': 'low', 'description': 'Alarm when * event occurred.', 'timestamp': datetime.datetime(2018, 10, 24, 12, 52, 55, 651317), 'user_id': 'feebe0e4f0264bebb53b1c2468a9da77', 'project_id': 'bc679e36e26b4640b1392e524d176ec2', 'state': 'alarm', 'state_reason': 'Event <id=fb7bf120-bacf-4972-88b2-c4a750098d67,event_type=compute.instance.power_off.start> hits the query <query=[]>.', 'state_timestamp': datetime.datetime(2018, 10, 24, 12, 52, 55, 651317), 'ok_actions': '[]', 'alarm_actions': '[]', 'insufficient_data_actions': '[]', 'repeat_actions': 0, 'rule': '{"event_type": "*", "query": []}', 'time_constraints': '[]', 'alarm_id_1': 'cd47c788-58df-4604-b21e-565d4055f872'}

aodh/storage/ (parameters above maps to class Alarm)

import datetime

from aodh.i18n import _
from import base

class Alarm(base.Model):
    An alarm to monitor.

    :param alarm_id: UUID of the alarm
    :param type: type of the alarm
    :param name: The Alarm name
    :param description: User friendly description of the alarm
    :param enabled: Is the alarm enabled
    :param state: Alarm state (ok/alarm/insufficient data)
    :param state_reason: Alarm state reason
    :param rule: A rule that defines when the alarm fires
    :param user_id: the owner/creator of the alarm
    :param project_id: the project_id of the creator
    :param evaluation_periods: the number of periods
    :param period: the time period in seconds
    :param time_constraints: the list of the alarm's time constraints, if any
    :param timestamp: the timestamp when the alarm was last updated
    :param state_timestamp: the timestamp of the last state change
    :param ok_actions: the list of webhooks to call when entering the ok state
    :param alarm_actions: the list of webhooks to call when entering the
                          alarm state
    :param insufficient_data_actions: the list of webhooks to call when
                                      entering the insufficient data state
    :param repeat_actions: Is the actions should be triggered on each
                           alarm evaluation.
    :param severity: Alarm level (low/moderate/critical)