Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions libmachine/provision/amazon2.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package provision

import (
"github.com/docker/machine/libmachine/drivers"
)

func init() {
Register("Amazon2", &RegisteredProvisioner{
New: NewAmazon2Provisioner,
})
}

func NewAmazon2Provisioner(d drivers.Driver) Provisioner {
return &Amazon2Provisioner{
NewRedHatProvisioner("amazon2", d),
}
}

type Amazon2Provisioner struct {
*RedHatProvisioner
}

func (provisioner *Amazon2Provisioner) String() string {
return "amazon2"
}
32 changes: 32 additions & 0 deletions libmachine/provision/os_release_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ PRETTY_NAME="Fedora 23 (Twenty Three)"
ANSI_COLOR="0;34"
HOME_URL="https://fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
`)

amazon2 = []byte(`NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
`)
)

Expand Down Expand Up @@ -168,6 +179,27 @@ BUG_REPORT_URL="https://bugzilla.redhat.com/"
if !reflect.DeepEqual(*osr, expectedOsr) {
t.Fatal("Error with fedora osr parsing: structs do not match")
}

osr, err = NewOsRelease(amazon2)
if err != nil {
t.Fatalf("Unexpected error parsing os release: %s", err)
}

expectedOsr = OsRelease{
Name: "Amazon Linux",
Version: "2",
ID: "amzn",
IDLike: "centos rhel fedora",
PrettyName: "Amazon Linux 2",
AnsiColor: "0;33",
VersionID: "2",
HomeURL: "https://amazonlinux.com/",
}

if !reflect.DeepEqual(*osr, expectedOsr) {
t.Fatal("Error with amazon2 osr parsing: structs do not match")
}

}

func TestParseLine(t *testing.T) {
Expand Down