Saltstack报错
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Saltstack报错相关的知识,希望对你有一定的参考价值。
最近学习saltstack,出现以下错误
[[email protected] ~]# 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)))
检查客户端版本问题,然并卵。
[[email protected] ~]# 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
但是我和他的出错原因并不一样,
[[email protected] init]# pwd
/etc/salt/states/init
[[email protected] init]# vim pkg.sls
pkg.init:#起一个名字而已
pkg.installed:
- names:
- lrzsz
- mtr
- nmap
看到没有,我在pkg.sls里加入了中文字符了。所以会出现###python编码错误####
解决这个问题可以设置默认的编码。python 2.x的默认编码是ascii,如果改为utf-8,就可以了
以上是关于Saltstack报错的主要内容,如果未能解决你的问题,请参考以下文章
saltstack api wheel模块报错HTTP/1.1 401 Unauthorized
saltstack操作远程执行命令报错:“is running as PID 113257 and was started at”的解决
saltstack--关于报错“UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 6: