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

TrueNAS scale #75

Open
valgeirhelgi opened this issue Nov 13, 2021 · 7 comments
Open

TrueNAS scale #75

valgeirhelgi opened this issue Nov 13, 2021 · 7 comments

Comments

@valgeirhelgi
Copy link

valgeirhelgi commented Nov 13, 2021

Hi!
I'm having issues with using your integration with TrueNAS scale. I'm wondering if it could just be the fact that I'm using Scale. But here is the error.

2021-11-13 03:18:10 ERROR (MainThread) [custom_components.truenas.config_flow] Unexpected exception
Traceback (most recent call last):
File "/usr/local/lib/python3.9/encodings/idna.py", line 165, in encode
raise UnicodeError("label empty or too long")
UnicodeError: label empty or too long
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/config/custom_components/truenas/config_flow.py", line 126, in async_step_auth_api_key
info = await validate_input(self.hass, self._user_data)
File "/config/custom_components/truenas/config_flow.py", line 54, in validate_input
machine = await Machine.create(
File "/usr/local/lib/python3.9/site-packages/aiotruenas_client/websockets/machine.py", line 48, in create
await m.connect(
File "/usr/local/lib/python3.9/site-packages/aiotruenas_client/websockets/machine.py", line 88, in connect
await self._connect(auth_protocol, host, secure)
File "/usr/local/lib/python3.9/site-packages/aiotruenas_client/websockets/machine.py", line 171, in _connect
await connect(
File "/usr/local/lib/python3.9/site-packages/websockets/legacy/client.py", line 622, in await_impl
transport, protocol = await self._create_connection()
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1017, in create_connection
infos = await self._ensure_resolved(
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1396, in _ensure_resolved
return await loop.getaddrinfo(host, port, family=family, type=type,
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 856, in getaddrinfo
return await self.run_in_executor(
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.9/socket.py", line 954, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
UnicodeError: encoding with 'idna' codec failed (UnicodeError: label empty or too long)

@sdwilsh
Copy link
Owner

sdwilsh commented Nov 15, 2021

TrueNAS claims that it's supposed to be the same API for both, but I've only tested it against Core, not Scale. It'll be awhile before I have the time to spin up a Scale VM to try and debug this.

With that said, it seems like the error is in Python before it even talks to the server, so I don't think it's a Scale vs Core issue: https://github.com/sdwilsh/hass-truenas/blob/main/custom_components/truenas/config_flow.py#L101

@sdwilsh
Copy link
Owner

sdwilsh commented Nov 15, 2021

Oh wait, that stack trace is backwards from what I'd expect. It is trying to talk to the server.

I think this is https://bugs.python.org/issue32958. I'm guessing you have a long hostname and long username/password?

@valgeirhelgi
Copy link
Author

Hmm... I'm using the API key, because I get "Invalid Auth" if I try to use User/Pass.

@valgeirhelgi
Copy link
Author

Ohhh yeah, my password is 16 characters and user is 7 char. Sorry forgot to let you know.

@sdwilsh
Copy link
Owner

sdwilsh commented Dec 21, 2021

Looking into this further, we don't use username@hostname to connect. The length of the password, username, and api key doesn't matter, since those are sent as a method over the websocket connection. Is your DNS name longer than 64 characters?

@valgeirhelgi
Copy link
Author

I just have the default.

image

sdwilsh added a commit that referenced this issue Dec 31, 2021
This will pick up some core library updates as well as some additional
logging to help debug #85 and #75.
sdwilsh added a commit that referenced this issue Dec 31, 2021
This will pick up some core library updates as well as some additional
logging to help debug #85 and #75.
sdwilsh added a commit that referenced this issue Dec 31, 2021
This will pick up some core library updates as well as some additional
logging to help debug #85 and #75.
@sdwilsh
Copy link
Owner

sdwilsh commented Dec 31, 2021

v0.3.0 of this custom integration has some additional logging code which might help us figure out what is going on here. To do this, you'll want to update the logger integration with the following lines:

  logs:
    aiotruenas_client: debug
    custom_components.truenas: debug

Mine looks like this:

logger:
  default: info
  logs:
    aiotruenas_client: debug
    custom_components.truenas: debug

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

2 participants