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

Fix openSUSE leap and SLES detection in Chef 14 #1377

Merged
merged 2 commits into from Jul 20, 2019

Conversation

@balasankarc
Copy link

balasankarc commented Jun 14, 2019

Detection of openSUSE leap and SLES distributions fail with Chef 14 because these distributions satisfy the if File.exist?('/usr/lib/os-release') check. However, in that check, we only consider Clear Linux and not anything else, thus causing detection to fail for any other OS.

In my experiments, all the Clear Linux distributions provided /etc/os-release file also. So, moving Clear Linux detection to be based on that file, and using /usr/lib/os-release only if /etc/os-release is not found (to handle any weird edge cases out there) seems like a safe option to handle Clear Linux, openSUSE Leap and SLES.

Related Issue

#1343

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.
Balasankar "Balu" C
Clear Linux OS also ships a /etc/os-release file. A check for
/usr/lib/os-release file returns true for openSUSE Leap and SLES
distributions, but we are not handling them in that block. It is easier
just to move Clear Linux check to /etc/os-release. Left the existing
code block there to handle any weird edge cases where
/usr/lib/os-release exists but /etc/os-release doesn't.

Signed-off-by: Balasankar "Balu" C <balasankar@gitlab.com>
@balasankarc balasankarc force-pushed the balasankarc:fix-opensuse-leap-chef-14 branch from 8074e8e to 320a6b5 Jun 14, 2019
@@ -266,7 +266,8 @@ def determine_platform_family
elsif File.exist?("/etc/alpine-release")
platform "alpine"
platform_version File.read("/etc/alpine-release").strip
elsif File.exist?("/usr/lib/os-release")
# If /etc/os-release file exists, we take that as source of truth
elsif File.exist?("/usr/lib/os-release") && !File.exist?("/etc/os-release")

This comment has been minimized.

Copy link
@balasankarc

balasankarc Jun 14, 2019

Author

@tas50 Does this make sense? && !File.exist?("/etc/os-release") essentially ensures openSUSE Leap and SLES not match with this check.

This comment has been minimized.

Copy link
@balasankarc

balasankarc Jun 14, 2019

Author

CI failures doesn't seem related to my change. 🤔

Balasankar "Balu" C
Signed-off-by: Balasankar "Balu" C <balasankar@gitlab.com>
@tas50 tas50 merged commit 11a13de into chef:14-stable Jul 20, 2019
2 of 4 checks passed
2 of 4 checks passed
buildkite/chef-ohai-14-stable-verify Build #46 failed (1 minute, 33 seconds)
Details
continuous-integration/appveyor/pr AppVeyor build failed
Details
DCO This commit has a DCO Signed-off-by
Details
expeditor/config-validation Validated your Expeditor config file
Details
@tas50

This comment has been minimized.

Copy link
Member

tas50 commented Jul 20, 2019

Thanks @balasankarc

@tas50 tas50 mentioned this pull request Jul 20, 2019
@balasankarc

This comment has been minimized.

Copy link
Author

balasankarc commented Jul 20, 2019

@tas50 Thanks for merging. Would it be possible to cut a new 14.x release to Rubygems with this PR and #1375 included?

@balasankarc balasankarc deleted the balasankarc:fix-opensuse-leap-chef-14 branch Jul 20, 2019
@balasankarc

This comment has been minimized.

Copy link
Author

balasankarc commented Aug 16, 2019

@tas50 Thanks for merging. Would it be possible to cut a new 14.x release to Rubygems with this PR and #1375 included?

I see 14.14.0 has been released. Thanks. Much appreciated.

@lock

This comment has been minimized.

Copy link

lock bot commented Oct 15, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can’t perform that action at this time.