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

Minion crashes with long hostname under Python 3 #51160

Closed
amendlik opened this issue Jan 13, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@amendlik
Copy link
Contributor

commented Jan 13, 2019

Description of Issue/Question

The minion encounters a fatal exception on startup when running under Python 3 and the hostname is very long. My research indicates that the limit is 63 characters. Python 2 does not have this problem.

[ERROR   ] encoding with 'idna' codec failed (UnicodeError: label too long)
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/encodings/idna.py", line 167, in encode
    raise UnicodeError("label too long")
UnicodeError: label too long

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/salt/utils/parsers.py", line 210, in parse_args
    process_option_func()
  File "/usr/local/lib/python3.6/site-packages/salt/utils/parsers.py", line 548, in process_config_dir
    self.config.update(self.setup_config())
  File "/usr/local/lib/python3.6/site-packages/salt/utils/parsers.py", line 2727, in setup_config
    cache_minion_id=True)
  File "/usr/local/lib/python3.6/site-packages/salt/config/__init__.py", line 2397, in minion_config
    minion_id=minion_id)
  File "/usr/local/lib/python3.6/site-packages/salt/config/__init__.py", line 3733, in apply_minion_config
    cache_minion_id=cache_minion_id)
  File "/usr/local/lib/python3.6/site-packages/salt/config/__init__.py", line 3615, in get_id
    newid = salt.utils.network.generate_minion_id()
  File "/usr/local/lib/python3.6/site-packages/salt/utils/network.py", line 177, in generate_minion_id
    ret = salt.utils.stringutils.to_unicode(_generate_minion_id().first())
  File "/usr/local/lib/python3.6/site-packages/salt/utils/network.py", line 140, in _generate_minion_id
    hosts = DistinctList().append(socket.getfqdn()).append(platform.node()).append(socket.gethostname())
  File "/usr/local/lib/python3.6/socket.py", line 673, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeError: encoding with 'idna' codec failed (UnicodeError: label too long)
[ERROR   ] An un-handled exception was caught by salt's global exception handler:
TypeError: '>=' not supported between instances of 'UnicodeError' and 'int'
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/encodings/idna.py", line 167, in encode
    raise UnicodeError("label too long")
UnicodeError: label too long

Steps to Reproduce Issue

salt-call --local test.ping

Versions Report

v2018.3.3

@dwoz

This comment has been minimized.

Copy link
Contributor

commented Jan 14, 2019

@amendlik thanks very much for reporting this issue. Looks like it is mainly related to some unicode work and can be resolved.

@dwoz dwoz added this to the Approved milestone Jan 14, 2019

@dwoz dwoz self-assigned this Jan 14, 2019

@s0undt3ch s0undt3ch closed this in 1a4e307 Jan 23, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.