Skip to content

wrong logic for AMZN_2 validation  #124

@catsky

Description

@catsky

//for amz 1: os = "amzn_2018.03",
// for amz 2: os="amzn_2.0 (2017.12)"
os = . /etc/os-release 2> /dev/null && echo ${ID}_${VERSION_ID}.strip

//it's wrong to check which amzn version using the following line, which return false for both amzn versions
os.start_with?('amzn_') && !os.start_with?('amzn_2')

FYI

amz linux 1

[ec2-user@ip-x-x-x- ~]$ cat /etc/os-release
NAME="Amazon Linux AMI"
VERSION="2018.03"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2018.03"
PRETTY_NAME="Amazon Linux AMI 2018.03"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2018.03:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"

amz linux 2

[ec2-user@x-x-x-x ~]$ cat /etc/system-release
Amazon Linux release 2.0 (2017.12) LTS Release Candidate
[ec2-user@fresh-amazon-host ~]$ cat /etc/os-release
NAME="Amazon Linux"
VERSION="2.0 (2017.12)"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2.0"
PRETTY_NAME="Amazon Linux 2.0 (2017.12) LTS Release Candidate"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2.0"
HOME_URL="https://amazonlinux.com/"```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions