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

Found UnicodeDecodeError when trying to start Salt Master #48012

Closed
Timandes opened this Issue Jun 7, 2018 · 3 comments

Comments

@Timandes

Timandes commented Jun 7, 2018

Description of Issue/Question

When I upgraded the Salt Master and was trying to start it, I got a UnicodeDecodeError:

# service salt-master start
Starting salt-master daemon: [ERROR   ] 'ascii' codec can't decode byte 0xe9 in position 42: ordinal not in range(128)
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/salt/utils/parsers.py", line 209, in parse_args
    process_option_func()
  File "/usr/lib/python2.7/site-packages/salt/utils/parsers.py", line 547, in process_config_dir
    self.config.update(self.setup_config())
  File "/usr/lib/python2.7/site-packages/salt/utils/parsers.py", line 1770, in setup_config
    return config.master_config(self.get_config_file_path())
  File "/usr/lib/python2.7/site-packages/salt/config/__init__.py", line 3841, in master_config
    opts = apply_master_config(overrides, defaults)
  File "/usr/lib/python2.7/site-packages/salt/config/__init__.py", line 3931, in apply_master_config
    cache_minion_id=None)
  File "/usr/lib/python2.7/site-packages/salt/config/__init__.py", line 3597, in get_id
    newid = salt.utils.network.generate_minion_id()
  File "/usr/lib/python2.7/site-packages/salt/utils/network.py", line 172, in generate_minion_id
    ret = salt.utils.stringutils.to_unicode(_generate_minion_id().first())
  File "/usr/lib/python2.7/site-packages/salt/utils/network.py", line 156, in _generate_minion_id
    for hst in (line.strip().split('#')[0].strip().split() or None for line in f_hdl.read().split(os.linesep)):
  File "/usr/lib/python2.7/site-packages/salt/utils/network.py", line 156, in <genexpr>
    for hst in (line.strip().split('#')[0].strip().split() or None for line in f_hdl.read().split(os.linesep)):
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 42: ordinal not in range(128)
Usage: salt-master [options]

salt-master: error: Error while processing <bound method Master.process_config_dir of <salt.cli.daemons.Master object at 0x7f17a4890c50>>: Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/salt/utils/parsers.py", line 209, in parse_args
    process_option_func()
  File "/usr/lib/python2.7/site-packages/salt/utils/parsers.py", line 547, in process_config_dir
    self.config.update(self.setup_config())
  File "/usr/lib/python2.7/site-packages/salt/utils/parsers.py", line 1770, in setup_config
    return config.master_config(self.get_config_file_path())
  File "/usr/lib/python2.7/site-packages/salt/config/__init__.py", line 3841, in master_config
    opts = apply_master_config(overrides, defaults)
  File "/usr/lib/python2.7/site-packages/salt/config/__init__.py", line 3931, in apply_master_config
    cache_minion_id=None)
  File "/usr/lib/python2.7/site-packages/salt/config/__init__.py", line 3597, in get_id
    newid = salt.utils.network.generate_minion_id()
  File "/usr/lib/python2.7/site-packages/salt/utils/network.py", line 172, in generate_minion_id
    ret = salt.utils.stringutils.to_unicode(_generate_minion_id().first())
  File "/usr/lib/python2.7/site-packages/salt/utils/network.py", line 156, in _generate_minion_id
    for hst in (line.strip().split('#')[0].strip().split() or None for line in f_hdl.read().split(os.linesep)):
  File "/usr/lib/python2.7/site-packages/salt/utils/network.py", line 156, in <genexpr>
    for hst in (line.strip().split('#')[0].strip().split() or None for line in f_hdl.read().split(os.linesep)):
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 42: ordinal not in range(128)

Setup

I think there is no need to provide it. : )

Steps to Reproduce Issue

  • Make sure /etc/hostname and /etc/nodename are all absent.
  • Add some comments to /etc/hosts file with Chinese characters, such as:
# 以下为主机名解析
## ccc
127.0.0.1       localhost            # 本机
  • Run:
service salt-master start

Versions Report

Salt Version:
           Salt: 2018.3.0

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8.1
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.13 (default, Jul 12 2017, 17:32:34)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.5.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: centos 6.2 Final
         locale: UTF-8
        machine: x86_64
        release: 2.6.32-220.7.1.el6.x86_64
         system: Linux
        version: CentOS 6.2 Final
@gtmanfred

This comment has been minimized.

Contributor

gtmanfred commented Jun 7, 2018

Thanks for reporting this.

We will get it fixed.
Daniel

@rallytime

This comment has been minimized.

Contributor

rallytime commented Jun 11, 2018

@terminalmage Can you fix this one?

@terminalmage

This comment has been minimized.

Member

terminalmage commented Jun 13, 2018

@rallytime Fixed in #48081

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment