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

Bug 1913582: fix IsLikeTraditionalRhel7() to account for minor versions #2332

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/daemon/osrelease.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ func (os OperatingSystem) IsCoreOSVariant() bool {
// yum based + kickstart/cloud-init (not Ignition).
func (os OperatingSystem) IsLikeTraditionalRHEL7() bool {
// Today nothing else is going to show up with a version ID of 7
if len(os.VersionID) > 2 {
return strings.HasPrefix(os.VersionID, "7.")
}
return os.VersionID == "7"
}

Expand Down
18 changes: 18 additions & 0 deletions pkg/daemon/osrelease_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package daemon

import (
"github.com/stretchr/testify/assert"
"testing"
)

func TestIsLikeTraditionalRHEL7(t *testing.T) {
var testOS OperatingSystem
testOS.VersionID = "7"
assert.True(t, testOS.IsLikeTraditionalRHEL7())
testOS.VersionID = "7.5"
assert.True(t, testOS.IsLikeTraditionalRHEL7())
testOS.VersionID = "8"
assert.False(t, testOS.IsLikeTraditionalRHEL7())
testOS.VersionID = "6.8"
assert.False(t, testOS.IsLikeTraditionalRHEL7())
}