X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=inline;f=osm_mon%2Fplugins%2FOpenStack%2FAodh%2Fnotifier.py;h=55178fd00d36d2007d58e53cfa8789d0436751cd;hb=refs%2Fchanges%2F60%2F6060%2F4;hp=c09ad9e41bc1b3cfeb738a076f2ec7003b7ebb58;hpb=75512477988ae5e287433c6c859c61de1bc82318;p=osm%2FMON.git
diff --git a/osm_mon/plugins/OpenStack/Aodh/notifier.py b/osm_mon/plugins/OpenStack/Aodh/notifier.py
index c09ad9e..55178fd 100644
--- a/osm_mon/plugins/OpenStack/Aodh/notifier.py
+++ b/osm_mon/plugins/OpenStack/Aodh/notifier.py
@@ -70,6 +70,10 @@ class NotifierHandler(BaseHTTPRequestHandler):
# Gets the size of data
content_length = int(self.headers['Content-Length'])
post_data = self.rfile.read(content_length)
+ try:
+ post_data = post_data.decode()
+ except AttributeError:
+ pass
self.wfile.write("
POST!
")
log.info("This alarm was triggered: %s", json.loads(post_data))
@@ -122,9 +126,9 @@ class NotifierHandler(BaseHTTPRequestHandler):
except Exception as exc:
log.exception("Couldn't notify SO of the alarm:")
else:
- log.warn("No resource_id for alarm; no SO response sent.")
+ log.warning("No resource_id for alarm; no SO response sent.")
else:
- log.warn("Authentication failure; SO notification not sent.")
+ log.warning("Authentication failure; SO notification not sent.")
except:
log.exception("Could not notify alarm.")
@@ -138,7 +142,7 @@ def run(server_class=HTTPServer, handler_class=NotifierHandler, port=8662):
log.info("Starting alarm notifier server on port: %s", port)
httpd.serve_forever()
except Exception as exc:
- log.warn("Failed to start webserver, %s", exc)
+ log.warning("Failed to start webserver, %s", exc)
if __name__ == "__main__":