Skip to content

Commit c6b14f0

Browse files
committed
source: make PLATFORM_ID in /etc/os-release optional
The PLATFORM_ID got retired from fedora-43 [0] and it seems like it was always kinda optional. So lets make it optional for real to avoid failing to build fedora-43 images. [0] https://fedoraproject.org/wiki/Changes/Drop_PLATFORM_ID
1 parent 07e8bf7 commit c6b14f0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

bib/internal/source/source.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ type Info struct {
2626
}
2727

2828
func validateOSRelease(osrelease map[string]string) error {
29-
// VARIANT_ID is optional
30-
for _, key := range []string{"ID", "VERSION_ID", "NAME", "PLATFORM_ID"} {
29+
// VARIANT_ID, PLATFORM_ID are optional
30+
for _, key := range []string{"ID", "VERSION_ID", "NAME"} {
3131
if _, ok := osrelease[key]; !ok {
3232
return fmt.Errorf("missing %s in os-release", key)
3333
}

bib/internal/source/source_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ func TestLoadInfo(t *testing.T) {
6262
{"happy", "fedora", "40", "Fedora Linux", "fedora", "platform:f40", "coreos", "", ""},
6363
{"happy-no-uefi", "fedora", "40", "Fedora Linux", "", "platform:f40", "coreos", "", ""},
6464
{"happy-no-variant_id", "fedora", "40", "Fedora Linux", "", "platform:f40", "", "", ""},
65+
{"happy-no-id", "fedora", "43", "Fedora Linux", "fedora", "", "", "", ""},
6566
{"happy-with-id-like", "centos", "9", "CentOS Stream", "", "platform:el9", "", "rhel fedora", ""},
6667
{"sad-no-id", "", "40", "Fedora Linux", "fedora", "platform:f40", "", "", "missing ID in os-release"},
6768
{"sad-no-id", "fedora", "", "Fedora Linux", "fedora", "platform:f40", "", "", "missing VERSION_ID in os-release"},
6869
{"sad-no-id", "fedora", "40", "", "fedora", "platform:f40", "", "", "missing NAME in os-release"},
69-
{"sad-no-id", "fedora", "40", "Fedora Linux", "fedora", "", "", "", "missing PLATFORM_ID in os-release"},
7070
}
7171

7272
for _, c := range cases {
@@ -81,7 +81,7 @@ func TestLoadInfo(t *testing.T) {
8181
info, err := LoadInfo(root)
8282

8383
if c.errorStr != "" {
84-
require.Equal(t, c.errorStr, err.Error())
84+
require.EqualError(t, err, c.errorStr)
8585
return
8686
}
8787
require.NoError(t, err)

0 commit comments

Comments
 (0)