盐客户端错误

SaltClient Error

我的 salt 客户端似乎有问题,我似乎无法确定问题出在哪里。

每当我尝试运行以下任何命令时:

sudo salt 'minion' pkg.refresh_db -l debug

我收到以下错误:

[DEBUG   ] Reading configuration from /etc/salt/master
[DEBUG   ] Including configuration from '/etc/salt/master.d/master.conf'
[DEBUG   ] Reading configuration from /etc/salt/master.d/master.conf
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: ECS-141abdb2.ecs.ads.autodesk.com
[DEBUG   ] Missing configuration file: /root/.saltrc
[DEBUG   ] Configuration file path: /etc/salt/master
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Reading configuration from /etc/salt/master
[DEBUG   ] Including configuration from '/etc/salt/master.d/master.conf'
[DEBUG   ] Reading configuration from /etc/salt/master.d/master.conf
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: ECS-141abdb2.ecs.ads.autodesk.com
[DEBUG   ] Missing configuration file: /root/.saltrc
[DEBUG   ] MasterEvent PUB socket URI: /var/run/salt/master/master_event_pub.ipc
[DEBUG   ] MasterEvent PULL socket URI: /var/run/salt/master/master_event_pull.ipc
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/master', 'ECS-141abdb2.ecs.ads.autodesk.com_master', 'tcp://127.0.0.1:4506', 'clear')
[DEBUG   ] Initializing new IPCClient for path: /var/run/salt/master/master_event_pub.ipc
[DEBUG   ] LazyLoaded local_cache.get_load
[DEBUG   ] Reading minion list from /var/cache/salt/master/jobs/37/32a84ef669f42a36e76c07f738738c/.minions.p
[DEBUG   ] get_iter_returns for jid 20161114145741459046 sent to set(['dss']) will timeout at 14:57:46.468061
[DEBUG   ] Checking whether jid 20161114145741459046 is still running
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/master', 'ECS-141abdb2.ecs.ads.autodesk.com_master', 'tcp://127.0.0.1:4506', 'clear')
[DEBUG   ] Passing on saltutil error. This may be an error in saltclient. 'retcode'
[DEBUG   ] Checking whether jid 20161114145741459046 is still running
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/master', 'ECS-141abdb2.ecs.ads.autodesk.com_master', 'tcp://127.0.0.1:4506', 'clear')
[DEBUG   ] Passing on saltutil error. This may be an error in saltclient. 'retcode'
[DEBUG   ] jid 20161114145741459046 return from dss
[DEBUG   ] LazyLoaded nested.output
dss:
The minion function caused an exception: Traceback (most recent call last):
  File "C:\salt\bin\lib\site-packages\salt\minion.py", line 1332, in _thread_return
    return_data = executor.execute()
  File "C:\salt\bin\lib\site-packages\salt\executors\direct_call.py", line 28, in execute
    return self.func(*self.args, **self.kwargs)
  File "C:\salt\bin\lib\site-packages\salt\modules\win_pkg.py", line 376, in refresh_db
    genrepo(saltenv=saltenv)
  File "C:\salt\bin\lib\site-packages\salt\modules\win_pkg.py", line 431, in genrepo
    for version, repodata in six.iteritems(versions):
  File "C:\salt\bin\lib\site-packages\salt\ext\six.py", line 583, in iteritems
    return iter(d.iteritems(**kw))
AttributeError: 'str' object has no attribute 'iteritems'
[DEBUG   ] jid 20161114145741459046 found all minions set(['dss'])

我的主配置文件如下所示:

The name of the top file where all the packages are specified

For basic Stingray BM
state_top: Win10.sls

 For Scaleform
 state_top: scaleform-setup.sls

 The location of the top file
 file_roots:
 base:
    - /srv/salt/

 winrepo_dir: /srv/salt/win/repo-ng

fileserver_backend:
  - git
  - roots
winrepo_dir_ng: '/srv/salt/win/repo-ng'
winrepo_provider: gitpython
win_repo_mastercachefile: '/srv/salt/win/repo-ng/salt-winrepo-ng/winrepo.p

之前运行异常。我在一个 minion 上安装了 cygwin,但由于某种原因现在它不起作用了。我不记得我是否更改了一些文件,但我尝试过的事情包括从 minion 中删除 cygwin、清除 master 缓存、清除 repo、重新安装 minion、将 master 和 minion 更新到最新版本(两者都是 2016.3.4 ).不知道这里有什么问题。

向上挖掘痕迹终于回答了这个问题。

在您配置的 win_repo 中的某处必须提到 versions 这是一个字符串而不是预期的字典。 Salt 只是没有正确处理这导致错误。

如果您不想手动检查 windows 状态,您可以在位于 C:\salt\bin\lib\site-packages\salt\modules\win_pkg.py 的 minion 上暂时打开 this file 添加 print(pkgname) - 之后看起来像这样:

for pkgname, versions in six.iteritems(config):
    print(pkgname)
    for version, repodata in six.iteritems(versions):

之后 运行 使用 salt-call pkg.refresh_db -l debug 在 minion 上本地加盐 - 从来没有在 windows 上这样做过,但是 it should be available - 我猜 C:\salt\bin 包括它。

包含让您的模块当前爆炸的 yaml 代码的 sls 文件应直接在堆栈跟踪上方输出。