Winrepo无法正常工作

时间:2016-11-01 20:02:31

标签: salt-stack

我需要将多个软件包部署到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并重新启动主机而没有运气。

1 个答案:

答案 0 :(得分:0)

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

  

winrepo git支持现在需要GitPython或pygit2。请安装GitPython&gt; = 0.3(或pygit2&gt; = 0.20.3,libgit2&gt; = 0.20.0),清除/ srv / salt / win / repo,然后重新启动salt-master服务。

检查是否存在其中一个库,如果不是使用pip或OS软件包安装它,则如上所述清除/srv/salt/win/repo。不要忘记之后重新启动salt-master。