Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3006.x] Handle permissions access error when calling ls_release with the salt user #65024

Merged
merged 2 commits into from
Aug 25, 2023

Conversation

s0undt3ch
Copy link
Collaborator

[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.

@s0undt3ch s0undt3ch requested a review from a team as a code owner August 22, 2023 08:07
@s0undt3ch s0undt3ch requested review from whytewolf and removed request for a team August 22, 2023 08:07
@salt-project-bot-prod-environment salt-project-bot-prod-environment bot changed the title Handle permissions access error when calling ls_release with the salt user [3006.x] Handle permissions access error when calling ls_release with the salt user Aug 22, 2023
@s0undt3ch s0undt3ch added this to the Sulfur v3006.3 milestone Aug 22, 2023
@s0undt3ch s0undt3ch temporarily deployed to ci August 22, 2023 08:26 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 22, 2023 08:26 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 22, 2023 08:26 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 22, 2023 08:26 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 22, 2023 08:43 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 22, 2023 08:49 — with GitHub Actions Inactive
Copy link
Contributor

@dmurphy18 dmurphy18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering about missing grains such as os_family if early return

salt/grains/core.py Outdated Show resolved Hide resolved
@s0undt3ch s0undt3ch force-pushed the hotfix/photonos-4-arm64 branch 3 times, most recently from 90718ca to fed0dae Compare August 24, 2023 08:34
@s0undt3ch s0undt3ch temporarily deployed to ci August 24, 2023 08:51 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 24, 2023 08:51 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 24, 2023 08:51 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 24, 2023 08:51 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 24, 2023 09:10 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 24, 2023 09:11 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 24, 2023 10:10 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 24, 2023 10:10 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 24, 2023 10:10 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 24, 2023 10:10 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 24, 2023 10:10 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 24, 2023 10:10 — with GitHub Actions Inactive
dmurphy18
dmurphy18 previously approved these changes Aug 24, 2023
Copy link
Contributor

@Ch3LL Ch3LL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add a regression test here?

…alt 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 <[email protected]>
@s0undt3ch s0undt3ch temporarily deployed to ci August 25, 2023 08:41 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 25, 2023 08:41 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 25, 2023 08:41 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 25, 2023 08:41 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 25, 2023 09:01 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 25, 2023 09:02 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 25, 2023 09:53 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 25, 2023 09:53 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 25, 2023 09:53 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 25, 2023 09:53 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 25, 2023 09:53 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 25, 2023 09:53 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 25, 2023 10:16 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 25, 2023 10:16 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 25, 2023 10:16 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 25, 2023 10:16 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 25, 2023 10:16 — with GitHub Actions Inactive
@s0undt3ch s0undt3ch temporarily deployed to ci August 25, 2023 10:16 — with GitHub Actions Inactive
@Ch3LL Ch3LL merged commit 56ae8aa into saltstack:3006.x Aug 25, 2023
323 checks passed
@s0undt3ch s0undt3ch deleted the hotfix/photonos-4-arm64 branch August 25, 2023 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants