mirror of https://github.com/docker/docs.git
Merge pull request #3564 from cdrage/add-variantid-to-osrelease
Add VARIANT and VARIANT_ID to os-release
This commit is contained in:
commit
34ea48e7dc
|
|
@ -20,6 +20,8 @@ type OsRelease struct {
|
|||
AnsiColor string `osr:"ANSI_COLOR"`
|
||||
Name string `osr:"NAME"`
|
||||
Version string `osr:"VERSION"`
|
||||
Variant string `osr:"VARIANT"`
|
||||
VariantID string `osr:"VARIANT_ID"`
|
||||
ID string `osr:"ID"`
|
||||
IDLike string `osr:"ID_LIKE"`
|
||||
PrettyName string `osr:"PRETTY_NAME"`
|
||||
|
|
|
|||
|
|
@ -46,7 +46,17 @@ PRETTY_NAME="CentOS Linux 7 (Core)"
|
|||
ANSI_COLOR="0;31"
|
||||
HOME_URL="https://www.centos.org/"
|
||||
BUG_REPORT_URL="https://bugs.centos.org/"
|
||||
|
||||
`)
|
||||
fedora = []byte(`NAME=Fedora
|
||||
VERSION="23 (Twenty Three)"
|
||||
ID=fedora
|
||||
VERSION_ID=23
|
||||
VARIANT="Server Edition"
|
||||
VARIANT_ID=server
|
||||
PRETTY_NAME="Fedora 23 (Twenty Three)"
|
||||
ANSI_COLOR="0;34"
|
||||
HOME_URL="https://fedoraproject.org/"
|
||||
BUG_REPORT_URL="https://bugzilla.redhat.com/"
|
||||
`)
|
||||
)
|
||||
|
||||
|
|
@ -136,6 +146,28 @@ BUG_REPORT_URL="https://bugs.centos.org/"
|
|||
if !reflect.DeepEqual(*osr, expectedOsr) {
|
||||
t.Fatal("Error with centos osr parsing: structs do not match")
|
||||
}
|
||||
|
||||
osr, err = NewOsRelease(fedora)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error parsing os release: %s", err)
|
||||
}
|
||||
|
||||
expectedOsr = OsRelease{
|
||||
Name: "Fedora",
|
||||
Version: "23 (Twenty Three)",
|
||||
ID: "fedora",
|
||||
PrettyName: "Fedora 23 (Twenty Three)",
|
||||
Variant: "Server Edition",
|
||||
VariantID: "server",
|
||||
AnsiColor: "0;34",
|
||||
VersionID: "23",
|
||||
HomeURL: "https://fedoraproject.org/",
|
||||
BugReportURL: "https://bugzilla.redhat.com/",
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(*osr, expectedOsr) {
|
||||
t.Fatal("Error with fedora osr parsing: structs do not match")
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseLine(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue