salt服务端向客户端同步grains错误一枚
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了salt服务端向客户端同步grains错误一枚相关的知识,希望对你有一定的参考价值。
在执行salt \* saltutil.sync_grains minion.salt.com: The minion function caused an exception: Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/salt/minion.py", line 1200, in _thread_return return_data = func(*args, **kwargs) File "/usr/lib/python2.6/site-packages/salt/modules/saltutil.py", line 343, in sync_grains ret = _sync(‘grains‘, saltenv) File "/usr/lib/python2.6/site-packages/salt/modules/saltutil.py", line 88, in _sync saltenv = _get_top_file_envs() File "/usr/lib/python2.6/site-packages/salt/modules/saltutil.py", line 70, in _get_top_file_envs top = st_.get_top() File "/usr/lib/python2.6/site-packages/salt/state.py", line 2444, in get_top return self.merge_tops(tops) File "/usr/lib/python2.6/site-packages/salt/state.py", line 2363, in merge_tops for saltenv, targets in ctop.items(): AttributeError: ‘str‘ object has no attribute ‘items‘
观察日志记录如下
服务端:
2016-02-23 12:30:41,096 [salt.master ][ERROR ][3138] Received minion error from [minion.salt.com]: The minion function caused an exception
客户端:
2016-02-02 00:46:33,058 [salt.minion ][WARNING ][1396] The minion function caused an exception
在客户端开启debug模式
salt-minion -l debug 2016-02-23 12:36:10,113 [salt.loaded.int.render.yaml][DEBUG ][1564] Results of YAML rendering: You should modify the /srv/salt/top.sls 2016-02-23 12:36:10,115 [salt.minion ][WARNING ][1564] The minion function caused an exception Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/salt/minion.py", line 1200, in _thread_return return_data = func(*args, **kwargs) File "/usr/lib/python2.6/site-packages/salt/modules/saltutil.py", line 343, in sync_grains ret = _sync(‘grains‘, saltenv) File "/usr/lib/python2.6/site-packages/salt/modules/saltutil.py", line 88, in _sync saltenv = _get_top_file_envs() File "/usr/lib/python2.6/site-packages/salt/modules/saltutil.py", line 70, in _get_top_file_envs top = st_.get_top() File "/usr/lib/python2.6/site-packages/salt/state.py", line 2444, in get_top return self.merge_tops(tops) File "/usr/lib/python2.6/site-packages/salt/state.py", line 2363, in merge_tops for saltenv, targets in ctop.items(): AttributeError: ‘str‘ object has no attribute ‘items‘
很明显/srv/salt/top.sls这个文件内容有问题
清空/srv/salt/top.sls再执行
salt \* saltutil.sync_grains
minion.salt.com: - grains.wlink
本文出自 “linux_cheng” 博客,请务必保留此出处http://6764097.blog.51cto.com/6754097/1744258
以上是关于salt服务端向客户端同步grains错误一枚的主要内容,如果未能解决你的问题,请参考以下文章
SaltStack-----安装,远程执行,grains,pillar,jinja模板