Merge "Load zaqar client outside init"

This commit is contained in:
Jenkins 2016-02-03 23:24:08 +00:00 committed by Gerrit Code Review
commit cb44c3a5f0

View File

@ -41,7 +41,7 @@ class ZaqarAlarmNotifier(notifier.AlarmNotifier):
def __init__(self, conf): def __init__(self, conf):
super(ZaqarAlarmNotifier, self).__init__(conf) super(ZaqarAlarmNotifier, self).__init__(conf)
self.conf = conf self.conf = conf
self.client = self.get_zaqar_client() self._zclient = None
def _get_endpoint(self): def _get_endpoint(self):
try: try:
@ -95,6 +95,12 @@ class ZaqarAlarmNotifier(notifier.AlarmNotifier):
message = dict(body=body) message = dict(body=body)
self.notify_zaqar(action, message) self.notify_zaqar(action, message)
@property
def client(self):
if self._zclient is None:
self._zclient = self.get_zaqar_client()
return self._zclient
def notify_zaqar(self, action, message): def notify_zaqar(self, action, message):
queue_info = urlparse.parse_qs(action.query) queue_info = urlparse.parse_qs(action.query)