Skip to content

Instantly share code, notes, and snippets.

@alq666
Created August 6, 2012 19:36
Show Gist options
  • Save alq666/3277858 to your computer and use it in GitHub Desktop.
Save alq666/3277858 to your computer and use it in GitHub Desktop.
Fixes invalid port type
diff --git a/ddagent.py b/ddagent.py
index fb3f50d..79ac59d 100755
--- a/ddagent.py
+++ b/ddagent.py
@@ -182,7 +182,7 @@ class ApiInputHandler(tornado.web.RequestHandler):
class Application(tornado.web.Application):
def __init__(self, port, agentConfig):
- self._port = port
+ self._port = int(port)
self._agentConfig = agentConfig
self._metrics = {}
self._watchdog = Watchdog(TRANSACTION_FLUSH_INTERVAL * WATCHDOG_INTERVAL_MULTIPLIER)
@@ -227,7 +227,7 @@ class Application(tornado.web.Application):
tornado.web.Application.__init__(self, handlers, **settings)
http_server = tornado.httpserver.HTTPServer(self)
http_server.listen(self._port)
- logging.info("Listening on port %s" % self._port)
+ logging.info("Listening on port %d" % self._port)
# Register callbacks
mloop = tornado.ioloop.IOLoop.instance()
@@ -263,13 +263,14 @@ def main():
agentConfig = get_config(parse_args = False)
- port = agentConfig.get('listen_port', None)
+ port = agentConfig.get('listen_port', 17123)
if port is None:
port = 17123
+ else:
+ port = int(port)
app = Application(port, agentConfig)
app.run()
if __name__ == "__main__":
main()
-
@alq666
Copy link
Author

alq666 commented Aug 7, 2012

How to apply:

curl -L http://dtdg.co/NXVC11 > /tmp/ddagent.py.diff
cd /usr/share/datadog/agent
patch -p0 < /tmp/ddagent.py.diff

If the patch fails, -p1 should do the trick (yes all computer bugs are off-by-ones :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment