ualex73 / monitor_docker

Monitor Docker containers from Home Assistant
Apache License 2.0
268 stars 34 forks source link

URL should be absolute #17

Closed ThaStealth closed 3 years ago

ThaStealth commented 3 years ago

When using the following config:

monitor_docker:
  - name: Docker-1
    url: 'http://<ip>:2375/'
  - name: Docker-2
    url: 'tcp://<ip>:2375/'

I get the following exception:


Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/util/thread.py", line 20, in run
    run_old(*args, **kwargs)
  File "/usr/local/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/config/custom_components/monitor_docker/__init__.py", line 78, in RunDocker
    hass.data[DOMAIN][entry[CONF_NAME]][API] = DockerAPI(hass, entry)
  File "/config/custom_components/monitor_docker/helpers.py", line 139, in __init__
    version = self._loop.run_until_complete(self._api.version())
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.7/site-packages/aiodocker/docker.py", line 166, in version
    data = await self._query_json("version")
  File "/usr/local/lib/python3.7/site-packages/aiodocker/docker.py", line 297, in _query_json
    versioned_api=versioned_api,
  File "/usr/local/lib/python3.7/site-packages/aiodocker/utils.py", line 309, in __aenter__
    resp = await self._coro
  File "/usr/local/lib/python3.7/site-packages/aiodocker/docker.py", line 229, in _do_query
    await self._check_version()
  File "/usr/local/lib/python3.7/site-packages/aiodocker/docker.py", line 181, in _check_version
    ver = await self._query_json("version", versioned_api=False)
  File "/usr/local/lib/python3.7/site-packages/aiodocker/docker.py", line 297, in _query_json
    versioned_api=versioned_api,
  File "/usr/local/lib/python3.7/site-packages/aiodocker/utils.py", line 309, in __aenter__
    resp = await self._coro
  File "/usr/local/lib/python3.7/site-packages/aiodocker/docker.py", line 245, in _do_query
    read_until_eof=read_until_eof,
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 573, in _request
    if url.origin() != r_url.origin():
  File "/usr/local/lib/python3.7/site-packages/yarl/__init__.py", line 359, in origin
    raise ValueError("URL should be absolute")
ValueError: URL should be absolute
ualex73 commented 3 years ago

I tested it, but I can't reproduce it. Maybe you can tell the exact configuration via email? ualex73 [at] gmail dot com.

GuyKh commented 3 years ago

@ualex73 Sent you an example in the mail

GuyKh commented 3 years ago

Found a solution - remove the / in the end. "tcp://192.168.1.99:2376" works for me

ualex73 commented 3 years ago

@GuyKh thanks for finding the solution! I will add it to the readme.

ualex73 commented 3 years ago

I will leave this one open for 1 week and if no further feedback received, I will close it.

ualex73 commented 3 years ago

Closed