GitFS integration with Salt master throwing AttributeError: '_pygit2.Blob' object has no attribute salt master log file
search cancel

GitFS integration with Salt master throwing AttributeError: '_pygit2.Blob' object has no attribute salt master log file

book

Article ID: 387122

calendar_today

Updated On:

Products

VMware Aria Suite

Issue/Introduction

The full example traceback message is shown below.

2025-01-28 10:25:02,823 [salt.utils.reactor:193 ][ERROR   ][2110563] Exception encountered while compiling reactions
Traceback (most recent call last):
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/reactor.py", line 179, in reactions
  high.update(self.render_reaction(fn_, tag, data))
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/reactor.py", line 59, in render_reaction
  glob_ref = self.minion.functions["cp.cache_file"](glob_ref) or ""
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
  ret = self.loader.run(run_func, *args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
  return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
  ret = _func_or_method(*args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/cp.py", line 552, in cache_file
  result = client.cache_file(
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/fileclient.py", line 190, in cache_file
  return self.get_url(
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/fileclient.py", line 519, in get_url
  result = self.get_file(url, dest, makedirs, saltenv, cachedir=cachedir)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/fileclient.py", line 1187, in get_file
  hash_server, stat_server = self.hash_and_stat_file(path, saltenv)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/fileclient.py", line 1437, in hash_and_stat_file
  hash_result = self.hash_file(path, saltenv)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/fileclient.py", line 1430, in hash_file
  return self.__hash_and_stat_file(path, saltenv)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/fileclient.py", line 1420, in __hash_and_stat_file
  return self._channel_send(
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/fileclient.py", line 1151, in _channel_send
  return self.channel.send(
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/fileserver/__init__.py", line 886, in send
  return getattr(self.fs, cmd)(load)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/fileserver/__init__.py", line 657, in file_hash
  return self.__file_hash_and_stat(load)[0]
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/fileserver/__init__.py", line 641, in __file_hash_and_stat
  fnd = self.find_file(
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/fileserver/__init__.py", line 599, in find_file
  fnd = self.servers[fstr](path, saltenv, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
  ret = self.loader.run(run_func, *args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
  return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
  ret = _func_or_method(*args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/fileserver/gitfs.py", line 160, in find_file
  return _gitfs().find_file(path, tgt_env=tgt_env, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/gitfs.py", line 3246, in find_file
  blob, blob_hexsha, blob_mode = repo.find_file(repo_path, tgt_env)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/gitfs.py", line 2280, in find_file
  return blob, blob.hex, mode
AttributeError: '_pygit2.Blob' object has no attribute 'hex'

 

As seen in the last line of the traceback message, the pygit2 library is unable to access an object attribute called "Blob". The exact cause of this issue is unknown, but more reading can be done at the following link in the community forums. https://github.com/saltstack/salt/issues/67017

 

 

Environment

Aria Config - all versions

SaltProject - 3006.9+

Resolution

Downgrade the pygit2 library from the latest installed version to an older version. Run the following steps on your Salt master(s). 

  1. Create a snapshot of your Salt master VM just in case
  2. Stop the Salt master daemon
    1. systemctl stop salt-master
  3. Run "salt-pip uninstall pygit2" to remove the current version of the library
  4. Confirm that the "patchelf" package is installed on your Salt master
    1. For RHEL based Salt masters, run "dnf install patchelf" 
    2. For Debian based Salt masters, run "apt install patchelf"
  5. Install version 1.14.1 of the pygit2 library with "salt-pip install pygit2==1.14.1" 
    1. This requires access to the Internet for direct installation. 
    2. This package can also be downoaded directly from PyPI here, https://pypi.org/project/pygit2/1.14.1/
      1. Once uploaded to the Salt master, install with salt-pip install /absolute/path/to/file
  6. Review the output carefully to ensure the module was installed successfully and that there were no errors during the installation
    1. If there are errors, then please check the error for any possible missing packages.
    2. If you see a message about being able to upgrad PIP itself, this is not necessary
  7. Clear the cache on the Salt master with "rm -fRv /var/cache/salt/master/gitfs"
  8. Start the Salt master daemon with "systemctl start salt-master"