FIX: OS detection 69/19969/3
authorPeter Mikus <pmikus@cisco.com>
Wed, 5 Jun 2019 08:59:37 +0000 (08:59 +0000)
committerPeter Mikus <pmikus@cisco.com>
Wed, 5 Jun 2019 09:36:56 +0000 (09:36 +0000)
Change-Id: I3ba6c7dc6a72e376419990ce7f5acc8d373f246f
Signed-off-by: Peter Mikus <pmikus@cisco.com>
resources/libraries/bash/entry/bootstrap_verify_perf.sh
resources/libraries/bash/entry/per_patch_device.sh
resources/libraries/bash/entry/per_patch_perf.sh
resources/libraries/bash/function/common.sh

index 84e2c32..0b46ff1 100644 (file)
@@ -36,6 +36,7 @@ common_dirs || die
 get_test_code "${1-}" || die
 get_test_tag_string || die
 select_topology || die
+select_os || die
 gather_build || die
 check_download_dir || die
 activate_virtualenv || die
index 19137e9..ac2c4a4 100644 (file)
@@ -45,6 +45,7 @@ get_test_code "${1-}" || die
 get_test_tag_string || die
 set_perpatch_dut || die
 select_topology || die
+select_os || die
 select_build "build_current" || die
 check_download_dir || die
 activate_virtualenv "${VPP_DIR}" || die
index 3569b21..b5e7bb9 100644 (file)
@@ -52,6 +52,7 @@ get_test_code "${1-}" || die
 get_test_tag_string || die
 set_perpatch_dut || die
 select_topology || die
+select_os || die
 activate_virtualenv "${VPP_DIR}" || die
 generate_tests || die
 archive_tests || die
index 399b449..02c65c8 100644 (file)
@@ -765,27 +765,29 @@ function select_os () {
 
     set -exuo pipefail
 
-    # Variables read:
-    # - OS - os or distro for selecting container image.
     # Variables set:
     # - VPP_VER_FILE - Name of File in CSIT dir containing vpp stable version.
     # - IMAGE_VER_FILE - Name of File in CSIT dir containing the image name.
     # - PKG_SUFFIX - Suffix of OS package file name, "rpm" or "deb."
 
-    case "${OS}" in
-    "ubuntu"*)
-        IMAGE_VER_FILE="VPP_DEVICE_IMAGE_UBUNTU"
-        VPP_VER_FILE="VPP_STABLE_VER_UBUNTU_BIONIC"
-        PKG_SUFFIX="deb"
-        ;;
-    "centos"*)
-        IMAGE_VER_FILE="VPP_DEVICE_IMAGE_CENTOS"
-        VPP_VER_FILE="VPP_STABLE_VER_CENTOS"
-        PKG_SUFFIX="rpm"
-        ;;
-    *)
-        die "Unable to identify distro or os from ${OS}"
-        ;;
+    os_id=$(grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g') || {
+        die "Get OS release failed."
+    }
+
+    case "${os_id}" in
+        "ubuntu"*)
+            IMAGE_VER_FILE="VPP_DEVICE_IMAGE_UBUNTU"
+            VPP_VER_FILE="VPP_STABLE_VER_UBUNTU_BIONIC"
+            PKG_SUFFIX="deb"
+            ;;
+        "centos"*)
+            IMAGE_VER_FILE="VPP_DEVICE_IMAGE_CENTOS"
+            VPP_VER_FILE="VPP_STABLE_VER_CENTOS"
+            PKG_SUFFIX="rpm"
+            ;;
+        *)
+            die "Unable to identify distro or os from ${OS}"
+            ;;
     esac
 }
 

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.