Signing git commits seems to confuse Salt when it parses the commit owner.
2016-04-12 14:19:00,715 [salt.master ][ERROR ][14475] Error in function _file_hash:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/master.py", line 1463, in run_func
ret = getattr(self, func)(load)
File "/usr/lib/python2.7/dist-packages/salt/fileserver/__init__.py", line 523, in file_hash
fnd = self.find_file(load['path'], load['saltenv'])
File "/usr/lib/python2.7/dist-packages/salt/fileserver/__init__.py", line 477, in find_file
fnd = self.servers[fstr](path, saltenv, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/fileserver/gitfs.py", line 1443, in find_file
tree = _get_tree_gitpython(repo, tgt_env)
File "/usr/lib/python2.7/dist-packages/salt/fileserver/gitfs.py", line 391, in _get_tree_gitpython
return ref.commit.tree
File "/usr/lib/python2.7/dist-packages/gitdb/util.py", line 238, in __getattr__
self._set_cache_(attr)
File "/usr/lib/python2.7/dist-packages/git/objects/commit.py", line 132, in _set_cache_
self._deserialize(StringIO(stream.read()))
File "/usr/lib/python2.7/dist-packages/git/objects/commit.py", line 443, in _deserialize
self.author.name = self.author.name.decode(self.encoding)
LookupError: unknown encoding: -----BEGIN PGP SIGNATURE-----
I believe SaltStack uses GitPython, I have GitPython 0.3.2 RC1 installed:
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import git
>>> git.__version__
'0.3.2 RC1'
$ dpkg -l | grep python-git
ii python-git 0.3.2~RC1-3 all Python library to interact with Git repositories
Not applicable.
Sign a git commit and push to your Salt GitFS repo AND have an old version of Git installed: 0.3.2 (0.3.2.1 fixes the problem)
Salt: 2015.5.10
Python: 2.7.6 (default, Mar 22 2014, 22:59:56)
Jinja2: 2.7.2
M2Crypto: 0.21.1
msgpack-python: 0.3.0
msgpack-pure: Not Installed
pycrypto: 2.6.1
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
PyZMQ: 14.3.1
RAET: Not Installed
ZMQ: 4.0.4
Mako: 0.9.1
Tornado: 4.2.1
timelib: Not Installed
dateutil: 2.4.2
Note: It looks like this has been fixed upstream, a workaround is manually pip-installing a newer version of git-python, see also: https://github.com/gitpython-developers/GitPython/issues/132
@c4urself, thanks for reporting. Salt does not work with git directly, but uses various git libraries, but this seems to be a good feature to have.
@jfindlay thanks for following up -- I guess this ticket can mostly be a findable documentation of the upstream bug that people can find easily :)
This is a workaround for Ubuntu 14.04:
sudo apt-get install python-pip; sudo pip install GitPython==0.3.2.1
This is still a bug on 2016.11.0, it has just happened to me. The answer from @lhotari still works and fixes the issue. The dependency should be updated.
Faced this problem on Debian Jessie, possible workaround install python-git
from backports
apt-get install --only-upgrade python-git -t jessie-backports
systemctl restart salt-master
Hi,
This workaround work for me, on Devuan 1.
Thanks @hatifnatt
Encounted this problem with 2018.3.0 on Ubuntu 14.04
The fix from @lhotari worked for me as well
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
Most helpful comment
This is a workaround for Ubuntu 14.04: