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

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>
@@ -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")
Copy link
Author

Choose a reason for hiding this comment

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

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

Copy link
Author

Choose a reason for hiding this comment

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

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

Signed-off-by: Balasankar "Balu" C <balasankar@gitlab.com>
@tas50 tas50 merged commit 11a13de into chef:14-stable Jul 20, 2019
@tas50
Copy link
Contributor

tas50 commented Jul 20, 2019

Thanks @balasankarc

@tas50 tas50 mentioned this pull request Jul 20, 2019
@balasankarc
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 fix-opensuse-leap-chef-14 branch July 20, 2019 05:34
@balasankarc
Copy link
Author

@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
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.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants