Skip to content

Commit

Permalink
Fix resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
ei-grad committed Apr 20, 2015
1 parent b1270f7 commit 28174f7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 21 deletions.
2 changes: 1 addition & 1 deletion docker_log_es/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Docker(object):

def __init__(self, filter_func=lambda x: {"message": str(x)}):
self.io_loop = IOLoop.current()
self.url = Storage.DOCKER
self.url = 'http://docker'
self._containers = {}
self.running = True
self.io_loop.add_callback(self.container_updater)
Expand Down
33 changes: 13 additions & 20 deletions docker_log_es/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,20 @@ def close(self):

@gen.coroutine
def resolve(self, host, port, *args, **kwargs):

scheme, path = Storage.DOCKER.split('://')
if host == 'docker' and scheme == 'unix':
raise gen.Return([(socket.AF_UNIX, path)])
elif scheme == 'tcp':
t = path.split(":")
if len(t) > 1:
host, port = t
port = int(port)
else:
host, port = t[0], 80

scheme, path = Storage.ELASTICSEARCH.split('://')
if host == 'elastic' and scheme == 'unix':
raise gen.Return([(socket.AF_UNIX, path)])
elif scheme == 'tcp':
t = path.split(":")
if len(t) > 1:
host, port = t
port = int(port)
else:
host, port = t[0], 80
if host == 'docker':

if scheme == 'unix':
raise gen.Return([(socket.AF_UNIX, path)])

elif scheme == 'tcp':
t = path.split(":")
if len(t) > 1:
host, port = t
port = int(port)
else:
host, port = t[0], 80

result = yield self.resolver.resolve(host, port, *args, **kwargs)
raise gen.Return(result)
Expand Down

0 comments on commit 28174f7

Please sign in to comment.