Search code examples
salt-project

Winrepo not working correctly


I have a number of packages that I need to deploy to window 10 machines. When trying to install a single package with:

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

Instead of the program being installed normally, a run command is generated and needs to be manually run to install the program.

I tried running:

sudo salt-run winrepo.update_git_repos

But I receive the following error:

/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'

I've tried refreshing the db but it doesn't seem to help. I also tried the following command with a similar results:

  sudo salt-run winrepo.genrepo

When trying to simply deploy my sls file for the programs I want installed, with the command:

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

I get the error:

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

My sls file looks like this:

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

I think the issue lies somewhere with winrepo. I tried installing GitPython and restarting the master with no luck.


Solution

  • There is this message hidden in your stacktrace:

    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.

    Check if one of the libraries is present, if not install it using either pip or OS packages and clear /srv/salt/win/repo afterwards as mentioned. Don't forget to restart the salt-master afterwards.