salt-cp时报错UnicodeDecodeError
问题描述
使用salt-cp拷贝了一个tar.gz的压缩包,结果在执行后报错,但是文件却已经完整的传输到了minion端。
问题出现的环境背景及自己尝试过哪些方法
我尝试将python2.7的代码环境换成UTF-8,重启salt-master和salt-minion后再次尝试,还是不行。
报错情况
[root@localhost ]# salt-cp '*' scan.tar.gz /web/soft/scan
[CRITICAL] Could not deserialize msgpack message. This often happens when trying to read a file not in binary mode. To see message payload, enable debug logging and retry. Exception: 'utf8' codec can't decode byte 0x8b in position 1: invalid start byte
[ERROR ] An un-handled exception was caught by salt's global exception handler:
UnicodeDecodeError: 'utf8' codec can't decode byte 0x8b in position 1: invalid start byte
Traceback (most recent call last):
File "/usr/bin/salt-cp", line 10, in <module>
salt_cp()
File "/usr/lib/python2.7/site-packages/salt/scripts.py", line 387, in salt_cp
client.run()
File "/usr/lib/python2.7/site-packages/salt/cli/cp.py", line 52, in run
cp_.run()
File "/usr/lib/python2.7/site-packages/salt/cli/cp.py", line 142, in run
ret = self.run_oldstyle()
File "/usr/lib/python2.7/site-packages/salt/cli/cp.py", line 165, in run_oldstyle
return local.cmd(*args)
File "/usr/lib/python2.7/site-packages/salt/client/__init__.py", line 741, in cmd
**kwargs):
File "/usr/lib/python2.7/site-packages/salt/client/__init__.py", line 1603, in get_cli_event_returns
**kwargs
File "/usr/lib/python2.7/site-packages/salt/client/__init__.py", line 1184, in get_iter_returns
for raw in ret_iter:
File "/usr/lib/python2.7/site-packages/salt/client/__init__.py", line 1109, in get_returns_no_block
no_block=True, auto_reconnect=self.auto_reconnect)
File "/usr/lib/python2.7/site-packages/salt/utils/event.py", line 642, in get_event
ret = self._get_event(wait, tag, match_func, no_block)
File "/usr/lib/python2.7/site-packages/salt/utils/event.py", line 544, in _get_event
mtag, data = self.unpack(raw, self.serial)
File "/usr/lib/python2.7/site-packages/salt/utils/event.py", line 435, in unpack
data = serial.loads(mdata, encoding='utf-8')
File "/usr/lib/python2.7/site-packages/salt/payload.py", line 144, in loads
ret = msgpack.loads(msg, use_list=True, ext_hook=ext_type_decoder, encoding=encoding)
File "msgpack/_unpacker.pyx", line 138, in msgpack._unpacker.unpackb (msgpack/_unpacker.cpp:138)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x8b in position 1: invalid start byte
Traceback (most recent call last):
File "/usr/bin/salt-cp", line 10, in <module>
salt_cp()
File "/usr/lib/python2.7/site-packages/salt/scripts.py", line 387, in salt_cp
client.run()
File "/usr/lib/python2.7/site-packages/salt/cli/cp.py", line 52, in run
cp_.run()
File "/usr/lib/python2.7/site-packages/salt/cli/cp.py", line 142, in run
ret = self.run_oldstyle()
File "/usr/lib/python2.7/site-packages/salt/cli/cp.py", line 165, in run_oldstyle
return local.cmd(*args)
File "/usr/lib/python2.7/site-packages/salt/client/__init__.py", line 741, in cmd
**kwargs):
File "/usr/lib/python2.7/site-packages/salt/client/__init__.py", line 1603, in get_cli_event_returns
**kwargs
File "/usr/lib/python2.7/site-packages/salt/client/__init__.py", line 1184, in get_iter_returns
for raw in ret_iter:
File "/usr/lib/python2.7/site-packages/salt/client/__init__.py", line 1109, in get_returns_no_block
no_block=True, auto_reconnect=self.auto_reconnect)
File "/usr/lib/python2.7/site-packages/salt/utils/event.py", line 642, in get_event
ret = self._get_event(wait, tag, match_func, no_block)
File "/usr/lib/python2.7/site-packages/salt/utils/event.py", line 544, in _get_event
mtag, data = self.unpack(raw, self.serial)
File "/usr/lib/python2.7/site-packages/salt/utils/event.py", line 435, in unpack
data = serial.loads(mdata, encoding='utf-8')
File "/usr/lib/python2.7/site-packages/salt/payload.py", line 144, in loads
ret = msgpack.loads(msg, use_list=True, ext_hook=ext_type_decoder, encoding=encoding)
File "msgpack/_unpacker.pyx", line 138, in msgpack._unpacker.unpackb (msgpack/_unpacker.cpp:138)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x8b in position 1: invalid start byte
你期待的结果是什么?实际看到的错误信息又是什么?
不知道这是什么情况。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论