-
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
Fetching grains['os'] from /etc/os-release on SUSE systems if it is possible #33903
Changes from all commits
c00c9b5
7603139
7f7800f
63e2f27
1680f18
a0693aa
1afc12f
50175a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1038,6 +1038,7 @@ def id_(): | |
'SUSE': 'SUSE', | ||
'openSUSE Leap': 'SUSE', | ||
'openSUSE Tumbleweed': 'SUSE', | ||
'SLES_SAP': 'SUSE', | ||
'Solaris': 'Solaris', | ||
'SmartOS': 'Solaris', | ||
'OpenIndiana Development': 'Solaris', | ||
|
@@ -1283,6 +1284,9 @@ def os_data(): | |
grains['lsb_distrib_release'] = os_release['VERSION_ID'] | ||
if 'PRETTY_NAME' in os_release: | ||
grains['lsb_distrib_codename'] = os_release['PRETTY_NAME'] | ||
if 'CPE_NAME' in os_release: | ||
if ":suse:" in os_release['CPE_NAME'] or ":opensuse:" in os_release['CPE_NAME']: | ||
grains['os'] = "SUSE" | ||
elif os.path.isfile('/etc/SuSE-release'): | ||
grains['lsb_distrib_id'] = 'SUSE' | ||
version = '' | ||
|
@@ -1390,7 +1394,8 @@ def os_data(): | |
shortname = distroname.replace(' ', '').lower()[:10] | ||
# this maps the long names from the /etc/DISTRO-release files to the | ||
# traditional short names that Salt has used. | ||
grains['os'] = _OS_NAME_MAP.get(shortname, distroname) | ||
if 'os' not in grains: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The SUSE-specific stuff doesn't concern me but this bit affects all distros. Could you clarify your reasoning here? I tend to be very cautious about modifying anything that touches global grains detection logic. We have been bitten by this many times. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cachedout I don't see a problem here. The However, I see another trouble 💥 here: the whole code of this particular function soon to be a better "winner" than a Toyota design. I mean, let's look at this monster function... It is horrid and needs to be splitted, refactored and cleaned up. IMHO. Yes, only in Just my few cents. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cachedout I understand your concern, but currently I think there is no problem here. Before this PR, Now, with the PR, the only case where What do you think? Thanks @isbm for the comment |
||
grains['os'] = _OS_NAME_MAP.get(shortname, distroname) | ||
grains.update(_linux_cpudata()) | ||
grains.update(_linux_gpu_data()) | ||
elif grains['kernel'] == 'SunOS': | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is too much noise for setting the
os
key. I would put that into one clause: