Winrepo 无法正常工作

Winrepo not working correctly

我有一些包需要部署到 window 10 台机器上。尝试使用以下命令安装单个软件包时:

sudo salt <minion name> pkg.install <program> version=xxx

不是正常安装程序,而是生成一个运行命令,需要手动运行安装程序。

我试过了 运行宁:

sudo salt-run winrepo.update_git_repos

但我收到以下错误:

/usr/lib/python2.6/site-packages/salt/grains/core.py:1493: DeprecationWarning: The "osmajorrelease" will be a type of an integer.
/usr/lib/python2.6/site-packages/salt/runners/winrepo.py:174: DeprecationWarning: The 'win_repo' config option is deprecated, please use 'winrepo_dir' instead.
/usr/lib/python2.6/site-packages/salt/runners/winrepo.py:210: DeprecationWarning: winrepo git support now requires either GitPython or pygit2. Please install either GitPython >= 0.3 (or pygit2 >= 0.20.3 with libgit2 >= 0.20.0), clear out /srv/salt/win/repo, and restart the salt-master service.
Exception occurred in runner winrepo.update_git_repos: Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/salt/client/mixins.py", line 356, in low
data['return'] = self.functions[fun](*args, **kwargs)
File "/usr/lib/python2.6/site-packages/salt/runners/winrepo.py", line 248, in update_git_repos
result = mminion.states['git.latest'](remote_url,
 File "/usr/lib/python2.6/site-packages/salt/loader.py", line 1055, in __getitem__
func = super(LazyLoader, self).__getitem__(item)
File "/usr/lib/python2.6/site-packages/salt/utils/lazy.py", line 93, in __getitem__
raise KeyError(key)
KeyError: 'git.latest'

我试过刷新数据库,但似乎无济于事。我还尝试了以下命令,得到了类似的结果:

  sudo salt-run winrepo.genrepo

当尝试简单地为我想安装的程序部署我的 sls 文件时,使用命令:

sudo salt 'ds' state.apply <sls file>

我收到错误:

Too many functions declared in state '*' in SLS 'stingray-setup-Win10'

我的 sls 文件如下所示:

base:
  '*':
    - windows.states.<some program>
    - windows.states.<some program>
    -.....

我认为问题出在 winrepo 的某个地方。我尝试安装 GitPython 并重新启动 master,但没有成功。

您的堆栈跟踪中隐藏了这条消息:

winrepo git support now requires either GitPython or pygit2. Please install either GitPython >= 0.3 (or pygit2 >= 0.20.3 with libgit2 >= 0.20.0), clear out /srv/salt/win/repo, and restart the salt-master service.

检查是否存在其中一个库,如果不存在,请使用 pip 或 OS 包安装它,然后如前所述清除 /srv/salt/win/repo。之后别忘了重启salt-master。