Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inter_communication defaults agent IP address to 0.0.0.0 #11

Open
Tmonster opened this issue Jun 14, 2021 · 0 comments
Open

inter_communication defaults agent IP address to 0.0.0.0 #11

Tmonster opened this issue Jun 14, 2021 · 0 comments

Comments

@Tmonster
Copy link

Hi,

I have been working on getting Fogify to work on an ubuntu virtual image running in Vagrant. When attempting to deploy a topology, I was getting the following error from the controller

controller_1  | During handling of the above exception, another exception occurred:
controller_1  |
controller_1  | Traceback (most recent call last):
controller_1  |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
controller_1  |     rv = self.dispatch_request()
controller_1  |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
controller_1  |     return self.view_functions[rule.endpoint](**req.view_args)
controller_1  |   File "/usr/local/lib/python3.7/site-packages/flask/views.py", line 89, in view
controller_1  |     return self.dispatch_request(*args, **kwargs)
controller_1  |   File "/usr/local/lib/python3.7/site-packages/flask/views.py", line 163, in dispatch_request
controller_1  |     return meth(*args, **kwargs)
controller_1  |   File "/code/fogify/controller/views.py", line 277, in post
controller_1  |     res.append(Communicator(get_connector()).agents__perform_action(commands, instance_type=instance_type))
controller_1  |   File "/code/fogify/utils/inter_communication.py", line 50, in agents__perform_action
controller_1  |   File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 119, in post
controller_1  |     return request('post', url, data=data, json=json, **kwargs)
controller_1  |   File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 61, in request
controller_1  |     return session.request(method=method, url=url, **kwargs)
controller_1  |   File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 542, in request
controller_1  |     resp = self.send(prep, **send_kwargs)
controller_1  |   File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 655, in send
controller_1  |     r = adapter.send(request, **kwargs)
controller_1  |   File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
controller_1  |     raise ConnectionError(e, request=request)
controller_1  | requests.exceptions.ConnectionError: HTTPConnectionPool(host='0.0.0.0', port=5500): Max retries exceeded with url: /actions/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f51bc61f910>: Failed to establish a new connection: [Errno 111] Connection refused'))

I tracked it down to the utils/Communicator class. It looks like agents__perform_action defaults to 0.0.0.0 for the address of the agents if everything is hosted on one machine. I think this should be changed to agent so that the internal docker DNS can resolve the URL properly. In vagrant, 0.0.0.0 doesn't work as the virtual machine adopts a different host IP (not 100% sure how it works). Anyway, my fix was to check if socket.gethostbyname(i) returns 0.0.0.0. If so, the host name is changed to agent.

Let me know if there are any questions, this issue is probably more confusing than the others
--Tom Ebergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant