Skip to content

Commit

Permalink
rhel: explicit RHEL Atomic Host support
Browse files Browse the repository at this point in the history
Signed-off-by: RTann <[email protected]>
  • Loading branch information
RTann committed Jan 12, 2024
1 parent 6c4f1b5 commit 7c4ed91
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rhel/distributionscanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var (
_ indexer.DistributionScanner = (*DistributionScanner)(nil)
_ indexer.VersionedScanner = (*DistributionScanner)(nil)

releaseRegexp = regexp.MustCompile(`Red Hat Enterprise Linux (?:Server)?\s*(?:release)?\s*(\d+)(?:\.\d)?`)
releaseRegexp = regexp.MustCompile(`Red Hat Enterprise Linux (?:Server|Atomic Host)?\s*(?:release)?\s*(\d+)(?:\.\d)?`)
)

// DistributionScanner implements distribution detection logic for RHEL by looking for
Expand Down
3 changes: 2 additions & 1 deletion rhel/distributionscanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"io/fs"
"os"
"path"
"strings"
"testing"
)

Expand All @@ -27,7 +28,7 @@ func TestDistributionScanner(t *testing.T) {
if d == nil {
t.Fatal("missing distribution")
}
if got, want := d.Version, n; got != want {
if got, want := d.Version, strings.TrimPrefix(n, "atomichost-"); got != want {
t.Errorf("got: %q, want %q", got, want)
}
})
Expand Down
1 change: 1 addition & 0 deletions rhel/testdata/releasefiles/atomichost-7/etc/os-release
1 change: 1 addition & 0 deletions rhel/testdata/releasefiles/atomichost-7/etc/redhat-release
17 changes: 17 additions & 0 deletions rhel/testdata/releasefiles/atomichost-7/usr/lib/os-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
NAME="Red Hat Enterprise Linux Atomic Host"
VERSION="7.9"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Atomic Host"
VARIANT_ID=atomic.host
VERSION_ID="7.9"
PRETTY_NAME="Red Hat Enterprise Linux Atomic Host 7.9"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.9:GA:atomic-host"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION="7.9"
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.9"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Red Hat Enterprise Linux Atomic Host release 7.9

0 comments on commit 7c4ed91

Please sign in to comment.