salt/changelog/65024.fixed.md
Pedro Algarvio 717ae8089f Handle permissions access error when calling lsb_release with the salt user
```
[ERROR   ] [SaltMaster(id='master-NkEYGW')] An un-handled exception was caught by Salt's global exception handler:
CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 126.
Traceback (most recent call last):
  File "/usr/bin/salt-master", line 11, in <module>
    sys.exit(salt_master())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/scripts.py", line 88, in salt_master
    master.start()
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/cli/daemons.py", line 204, in start
    self.master.start()
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/master.py", line 723, in start
    chan = salt.channel.server.PubServerChannel.factory(opts)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/channel/server.py", line 721, in factory
    return cls(opts, transport, presence_events=presence_events)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/channel/server.py", line 727, in __init__
    self.aes_funcs = salt.master.AESFuncs(self.opts)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/master.py", line 1233, in __init__
    self.mminion = salt.minion.MasterMinion(
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/minion.py", line 974, in __init__
    self.opts = salt.config.mminion_config(
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/config/__init__.py", line 2332, in mminion_config
    opts["grains"] = salt.loader.grains(opts)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/__init__.py", line 1116, in grains
    ret = funcs[key]()
  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
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/grains/core.py", line 2602, in os_data
    grains.update(_linux_distribution_data())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/grains/core.py", line 2189, in _linux_distribution_data
    return _legacy_linux_distribution_data(grains, os_release, lsb_has_error)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/grains/core.py", line 2324, in _legacy_linux_distribution_data
    x.strip('"').strip("'") for x in _linux_distribution()
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/platform.py", line 21, in linux_distribution
    return distro.name(), distro.version(best=True), distro.codename()
  File "/opt/saltstack/salt/lib/python3.10/site-packages/distro.py", line 287, in version
    return _distro.version(pretty, best)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/distro.py", line 741, in version
    self.lsb_release_attr('release'),
  File "/opt/saltstack/salt/lib/python3.10/site-packages/distro.py", line 903, in lsb_release_attr
    return self._lsb_release_info.get(attribute, '')
  File "/opt/saltstack/salt/lib/python3.10/site-packages/distro.py", line 556, in __get__
    ret = obj.__dict__[self._fname] = self._f(obj)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/distro.py", line 1014, in _lsb_release_info
    stdout = subprocess.check_output(cmd, stderr=devnull)
  File "/opt/saltstack/salt/lib/python3.10/subprocess.py", line 421, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/opt/saltstack/salt/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 126.
```

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-08-25 13:57:39 +00:00

78 B

Handle permissions access error when calling lsb_release with the salt user