~ubuntu-branches/ubuntu/vivid/ceilometer/vivid

« back to all changes in this revision

Viewing changes to ceilometer/alarm/notifier/rest.py

  • Committer: Package Import Robot
  • Author(s): James Page, Corey Bryant, James Page
  • Date: 2015-02-19 14:59:07 UTC
  • mfrom: (1.2.3)
  • Revision ID: package-import@ubuntu.com-20150219145907-9jojybdsl64zcn14
Tags: 2015.1~b2-0ubuntu1
[ Corey Bryant ]
* New upstream release.
  - d/control: Align requirements with upstream.
  - d/p/skip-test.patch: Rebased.

[ James Page ]
* d/rules,d/p/skip-gabbi.patch: Skip tests that rely on python-gabbi until
  packaging and MIR is complete.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#
2
2
# Copyright 2013-2014 eNovance
3
3
#
4
 
# Author: Mehdi Abaakouk <mehdi.abaakouk@enovance.com>
5
 
#
6
4
# Licensed under the Apache License, Version 2.0 (the "License"); you may
7
5
# not use this file except in compliance with the License. You may obtain
8
6
# a copy of the License at
17
15
"""Rest alarm notifier."""
18
16
 
19
17
import eventlet
20
 
from oslo.config import cfg
21
18
from oslo.serialization import jsonutils
 
19
from oslo_config import cfg
 
20
from oslo_context import context
22
21
import requests
23
22
import six.moves.urllib.parse as urlparse
24
23
 
25
24
from ceilometer.alarm import notifier
26
25
from ceilometer.i18n import _
27
 
from ceilometer.openstack.common import context
28
26
from ceilometer.openstack.common import log
29
27
 
30
28
LOG = log.getLogger(__name__)
57
55
    """Rest alarm notifier."""
58
56
 
59
57
    @staticmethod
60
 
    def notify(action, alarm_id, alarm_name, previous, current, reason,
61
 
               reason_data, headers=None):
 
58
    def notify(action, alarm_id, alarm_name, severity, previous,
 
59
               current, reason, reason_data, headers=None):
62
60
        headers = headers or {}
63
61
        if not headers.get('x-openstack-request-id'):
64
62
            headers['x-openstack-request-id'] = context.generate_request_id()
68
66
            "%(previous)s to %(current)s with action %(action)s because "
69
67
            "%(reason)s. request-id: %(request_id)s ") %
70
68
            ({'alarm_name': alarm_name, 'alarm_id': alarm_id,
71
 
              'previous': previous, 'current': current,
72
 
              'action': action, 'reason': reason,
 
69
              'severity': severity, 'previous': previous,
 
70
              'current': current, 'action': action, 'reason': reason,
73
71
              'request_id': headers['x-openstack-request-id']}))
74
72
        body = {'alarm_name': alarm_name, 'alarm_id': alarm_id,
75
 
                'previous': previous, 'current': current,
76
 
                'reason': reason, 'reason_data': reason_data}
 
73
                'severity': severity, 'previous': previous,
 
74
                'current': current, 'reason': reason,
 
75
                'reason_data': reason_data}
77
76
        headers['content-type'] = 'application/json'
78
77
        kwargs = {'data': jsonutils.dumps(body),
79
78
                  'headers': headers}