-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[BUG] grain 'lsb_distrib_id' expected by salt/modules/network.py but not populated on Debian #65573
Comments
Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. |
A possible way to temporarily overcome this issue (though not a proper solution in my opinion) is to manually introduce the missing
|
@michaelroland The grains got re-arranged as to what takes precedence to resolve some issues. Let me go dig out the PR and issue etc. Here it is #61626 Can you review the PR and see if you can live with the reasons for the PR, and if so, close this issue, or offer suggestions as to what you needs to be fixed, as you determine it. |
@michaelroland FYI - native support for Debian 12 is coming in the next releases, at least that is the current plan, and the releases should be soon, before the end of the year. Presuming installed Debian 11 packages on Debian 12, which is what I shall do to investigate the network.py issue raised. |
Examining the issue, the 'lsb_' is only related to Debian 10, 11 and 12, but works fine on Ubuntu 20.04 and 22.04. On Debian 11 and 12, even though the lsb-release package is installed, it is not available with the native python installed, for example: Debian 12
Need to see why it is fine on Ubuntu, but suspect that given Ubuntu makes lsb_release available to it's python, the same occurs with Salt.
Salt cannot provide the 'lsb_xxx' grains since on Debian the lsb_release python bindings are not available.
So question is should fix network.py for key not available, and understand why Debian is not making lsb_release python bindings available |
Problem is this code here, if lsb_has_error is True, then should not be skipping merrily ahead for any of the mentioned OS's, see https://github.com/saltstack/salt/blob/master/salt/grains/core.py#L2150-L2170 |
Correct, that's also what I identified as the issue in my initial analysis, didn't realize that this was meant to be done only if filling lsb_* had not failed before. Thanks for taking care of this with your PR! This seems to solve the issue and I believe it can be closed once #65585 is merged. |
Closing since fixed by PR #65585 |
Description
When executing
network.system
on Debian 12, setting the hostname results in a stacktrace with aKeyError
on keylsb_distrib_id
. Looking throughsalt/grains/core.py
, it seems that thelsb_*
grains are no longer populated on Debian in favor ofos*
grains:salt/salt/grains/core.py
Lines 2142 to 2143 in ffab39b
and the following puts "debian" on the list of distributions no longer populating the
lsb_*
grains:salt/salt/grains/core.py
Lines 2159 to 2162 in ffab39b
However,
salt/modules/network.py
still relies on these variables for Debian:salt/salt/modules/network.py
Lines 1534 to 1538 in ffab39b
which results in a
KeyError
when accessing__grains__["lsb_distrib_id"]
on line 1537.Consequently, the
lsb_*
grains should be re-enabled for Debian or the network module (and potentially others?) needs to be adapted to the removal of these grains.Full stack trace produced by salt
Setup
This has been tested with salt-ssh from the saltproject.io Debian repository running on Debian 12. Installed salt packages on salt-ssh runner:
The target machine was a freshly installed VM with Debian 12.
Steps to Reproduce the behavior
The salt state to reproduce this is
salt/common/host.sls
:We test with
(having an entry for dns1e in our roster file).
Expected behavior
Applying the state should succeed without an error.
Versions Report
salt-ssh --versions-report
salt --versions-report
The text was updated successfully, but these errors were encountered: