~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): Chuck Short
  • Date: 2014-03-06 14:44:28 UTC
  • mto: (28.1.1 utopic-proposed) (1.2.1)
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: package-import@ubuntu.com-20140306144428-rvphsh4igwyulzf0
Tags: upstream-2014.1~b3
ImportĀ upstreamĀ versionĀ 2014.1~b3

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
import eventlet
21
21
import requests
22
 
import urlparse
 
22
import six.moves.urllib.parse as urlparse
23
23
 
24
24
from oslo.config import cfg
25
25
 
33
33
REST_NOTIFIER_OPTS = [
34
34
    cfg.StrOpt('rest_notifier_certificate_file',
35
35
               default='',
36
 
               help='SSL Client certificate for REST notifier'
 
36
               help='SSL Client certificate for REST notifier.'
37
37
               ),
38
38
    cfg.StrOpt('rest_notifier_certificate_key',
39
39
               default='',
40
 
               help='SSL Client private key for REST notifier'
 
40
               help='SSL Client private key for REST notifier.'
41
41
               ),
42
42
    cfg.BoolOpt('rest_notifier_ssl_verify',
43
43
                default=True,
44
 
                help='Verify the SSL Server certificate when \
45
 
                calling alarm action'
 
44
                help='Whether to verify the SSL Server certificate when '
 
45
                'calling alarm action.'
46
46
                ),
47
47
 
48
48
]
54
54
    """Rest alarm notifier."""
55
55
 
56
56
    @staticmethod
57
 
    def notify(action, alarm_id, previous, current, reason):
 
57
    def notify(action, alarm_id, previous, current, reason, reason_data):
58
58
        LOG.info(_(
59
59
            "Notifying alarm %(alarm_id)s from %(previous)s "
60
60
            "to %(current)s with action %(action)s because "
62
62
                              'current': current, 'action': action,
63
63
                              'reason': reason}))
64
64
        body = {'alarm_id': alarm_id, 'previous': previous,
65
 
                'current': current, 'reason': reason}
 
65
                'current': current, 'reason': reason,
 
66
                'reason_data': reason_data}
66
67
        kwargs = {'data': jsonutils.dumps(body)}
67
68
 
68
69
        if action.scheme == 'https':