From 87e1a0f50183278b7d7a723452bbf56b45e7f4ca Mon Sep 17 00:00:00 2001 From: Haim Helman Date: Wed, 10 Mar 2021 12:14:13 -0800 Subject: [PATCH] Added Photon OS to the list of distros Signed-off-by: Haim Helman --- syft/distro/identify_test.go | 5 +++++ syft/distro/test-fixtures/os/photon/etc/os-release | 8 ++++++++ syft/distro/type.go | 3 +++ 3 files changed, 16 insertions(+) create mode 100644 syft/distro/test-fixtures/os/photon/etc/os-release diff --git a/syft/distro/identify_test.go b/syft/distro/identify_test.go index 4c74e3251..3e73aa2c6 100644 --- a/syft/distro/identify_test.go +++ b/syft/distro/identify_test.go @@ -75,6 +75,11 @@ func TestIdentifyDistro(t *testing.T) { Type: OpenSuseLeap, Version: "15.2.0", }, + { + fixture: "test-fixtures/os/photon", + Type: Photon, + Version: "2.0.0", + }, { fixture: "test-fixtures/os/arch", Type: ArchLinux, diff --git a/syft/distro/test-fixtures/os/photon/etc/os-release b/syft/distro/test-fixtures/os/photon/etc/os-release new file mode 100644 index 000000000..cea880c42 --- /dev/null +++ b/syft/distro/test-fixtures/os/photon/etc/os-release @@ -0,0 +1,8 @@ +NAME="VMware Photon OS" +VERSION="2.0" +ID=photon +VERSION_ID=2.0 +PRETTY_NAME="VMware Photon OS/Linux" +ANSI_COLOR="1;34" +HOME_URL="https://vmware.github.io/photon/" +BUG_REPORT_URL="https://github.com/vmware/photon/issues" diff --git a/syft/distro/type.go b/syft/distro/type.go index aac86384a..0dec34d35 100644 --- a/syft/distro/type.go +++ b/syft/distro/type.go @@ -17,6 +17,7 @@ const ( OracleLinux Type = "oraclelinux" ArchLinux Type = "archlinux" OpenSuseLeap Type = "opensuseleap" + Photon Type = "photon" ) // All contains all Linux distribution options @@ -32,6 +33,7 @@ var All = []Type{ OracleLinux, ArchLinux, OpenSuseLeap, + Photon, } // IDMapping connects a distro ID like "ubuntu" to a Distro type @@ -47,6 +49,7 @@ var IDMapping = map[string]Type{ "ol": OracleLinux, "arch": ArchLinux, "opensuse-leap": OpenSuseLeap, + "photon": Photon, } // String returns the string representation of the given Linux distribution.