码迷,mamicode.com
首页 > 其他好文 > 详细

Saltstack报错

时间:2017-09-06 22:56:44      阅读:393      评论:0      收藏:0      [点我收藏+]

标签:linux   运维   

    最近学习saltstack,出现以下错误


[root@master ~]# salt ‘minion.saltstack.com‘ state.sls init.pkg
[ERROR   ] An un-handled exception was caught by salt‘s global exception handler:
UnicodeDecodeError: ‘ascii‘ codec can‘t decode byte 0xe8 in position 97: ordinal not in range(128)    ###python编码错误####

Traceback (most recent call last):
  File "/usr/bin/salt", line 10, in <module>
    salt_main()
  File "/usr/lib/python2.6/site-packages/salt/scripts.py", line 349, in salt_main
    client.run()
  File "/usr/lib/python2.6/site-packages/salt/cli/salt.py", line 210, in run
    self._output_ret(ret_, out)
  File "/usr/lib/python2.6/site-packages/salt/cli/salt.py", line 300, in _output_ret
    salt.output.display_output(ret, out, self.config)
  File "/usr/lib/python2.6/site-packages/salt/output/__init__.py", line 94, in display_output
    display_data = try_printout(data, out, opts)
  File "/usr/lib/python2.6/site-packages/salt/output/__init__.py", line 46, in try_printout
    return get_printout(out, opts)(data).rstrip()
  File "/usr/lib/python2.6/site-packages/salt/output/highstate.py", line 84, in output
    return _format_host(host, hostdata)[0]
  File "/usr/lib/python2.6/site-packages/salt/output/highstate.py", line 112, in _format_host
    .format(hcolor, err, colors)))

检查客户端版本问题,然并卵。

[root@minion ~]# salt-minion  --versions-report

          Salt: 2015.5.10

        Python: 2.6.6 (r266:84292, Aug 18 2016, 15:13:37)

        Jinja2: 2.2.1

      M2Crypto: 0.20.2

 msgpack-python: 0.4.6

  msgpack-pure: Not Installed

      pycrypto: 2.0.1

       libnacl: Not Installed

        PyYAML: 3.10

         ioflo: Not Installed

         PyZMQ: 14.3.1

          RAET: Not Installed

           ZMQ: 3.2.5

          Mako: Not Installed

       Tornado: Not Installed

       timelib: Not Installed

      dateutil: Not Installed

在网上寻找答案时发现有人和我有一样的报错,下面是链接:

http://nginxs.blog.51cto.com/4676810/1371072

但是我和他的出错原因并不一样,

[root@master init]# pwd
/etc/salt/states/init

[root@master init]# vim pkg.sls
pkg.init:#起一个名字而已
  pkg.installed:
    - names:
      - lrzsz
      - mtr
      - nmap

看到没有,我在pkg.sls里加入了中文字符了。所以会出现###python编码错误####

解决这个问题可以设置默认的编码。python 2.x的默认编码是ascii,如果改为utf-8,就可以了

Saltstack报错

标签:linux   运维   

原文地址:http://9302152.blog.51cto.com/9292152/1963216

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!