projects
/
osm
/
MON.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Adds vdu_id to message bus models
[osm/MON.git]
/
osm_mon
/
plugins
/
OpenStack
/
Aodh
/
notifier.py
diff --git
a/osm_mon/plugins/OpenStack/Aodh/notifier.py
b/osm_mon/plugins/OpenStack/Aodh/notifier.py
index
c09ad9e
..
55178fd
100644
(file)
--- 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)
# 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("<html><body><h1>POST!</h1></body></tml>")
log.info("This alarm was triggered: %s", json.loads(post_data))
self.wfile.write("<html><body><h1>POST!</h1></body></tml>")
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:
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.warn
ing
("No resource_id for alarm; no SO response sent.")
else:
else:
- log.warn("Authentication failure; SO notification not sent.")
+ log.warn
ing
("Authentication failure; SO notification not sent.")
except:
log.exception("Could not notify alarm.")
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.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.warn
ing
("Failed to start webserver, %s", exc)
if __name__ == "__main__":
if __name__ == "__main__":