From 8b01f23b758800a4887d03ff789f04863cee0368 Mon Sep 17 00:00:00 2001 From: Giovanni Torres Date: Thu, 11 Jan 2018 11:08:28 -0500 Subject: [PATCH] Added support for Amazon Linux 2 distribution --- README.md | 1 + kvm-install-vm | 12 ++++++++++-- tests/check_distributions.bats | 8 ++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9c67e2a..24efbb1 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,7 @@ OPTIONS DISTRIBUTIONS NAME DESCRIPTION LOGIN + amazon2 Amazon Linux 2 ec2-user centos7 CentOS 7 centos centos7-atomic CentOS 7 Atomic Host centos centos6 CentOS 6 centos diff --git a/kvm-install-vm b/kvm-install-vm index a102304..23d57e9 100755 --- a/kvm-install-vm +++ b/kvm-install-vm @@ -61,6 +61,7 @@ function usage_subcommand () printf "\n" printf "DISTRIBUTIONS\n" printf " NAME DESCRIPTION LOGIN\n" + printf " amazon2 Amazon Linux 2 ec2-user\n" printf " centos7 CentOS 7 centos\n" printf " centos7-atomic CentOS 7 Atomic Host centos\n" printf " centos6 CentOS 6 centos\n" @@ -210,7 +211,14 @@ function fetch_images () mkdir -p ${IMAGEDIR} # Set variables based on $DISTRO + # Use the command "osinfo-query os" to get the list of the accepted OS variants. case "$DISTRO" in + amazon2) + QCOW=amzn2-kvm-2017.12.0.20171212.2-x86_64.xfs.gpt.qcow2 + OS_VARIANT="auto" + IMAGE_URL=https://cdn.amazonlinux.com/os-images/2017.12.0.20171212.2/kvm + LOGIN_USER=ec2-user + ;; centos7) QCOW=CentOS-7-x86_64-GenericCloud.qcow2 OS_VARIANT="centos7.0" @@ -319,7 +327,7 @@ function storpool_exists () function set_sudo_group () { case "${DISTRO}" in - centos?|fedora??|*-atomic ) + centos?|fedora??|*-atomic|amazon? ) SUDOGROUP="wheel" ;; ubuntu*|debian? ) @@ -334,7 +342,7 @@ function set_sudo_group () function set_cloud_init_remove () { case "${DISTRO}" in - centos? ) + centos?|amazon? ) CLOUDINITRM="yum -y remove cloud-init" ;; fedora?? ) diff --git a/tests/check_distributions.bats b/tests/check_distributions.bats index df4dc84..7c4b8f4 100644 --- a/tests/check_distributions.bats +++ b/tests/check_distributions.bats @@ -16,6 +16,14 @@ function remove_test_vm () [ "$status" -eq 0 ] } +@test "Install VM (Amazon Linux 2) - $VMNAME-amazon2" { + create_test_vm amazon2 +} + +@test "Delete VM (Amazon Linux 2) - $VMNAME-amazon2" { + remove_test_vm amazon2 +} + @test "Install VM (CentOS 7 Atomic) - $VMNAME-centos7-atomic" { create_test_vm centos7-atomic }