aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2019-06-05 08:59:37 +0000
committerPeter Mikus <pmikus@cisco.com>2019-06-05 09:36:56 +0000
commite5c9717d241c005b4546ada80b5b85a40cde2061 (patch)
tree23dc39048594e5ffdec01795ddc05091a69cc49c /resources/libraries
parentea6e8be86d47b288df5e11ca5515f6bda71dbd08 (diff)
FIX: OS detection
Change-Id: I3ba6c7dc6a72e376419990ce7f5acc8d373f246f Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries')
-rw-r--r--resources/libraries/bash/entry/bootstrap_verify_perf.sh1
-rw-r--r--resources/libraries/bash/entry/per_patch_device.sh1
-rw-r--r--resources/libraries/bash/entry/per_patch_perf.sh1
-rw-r--r--resources/libraries/bash/function/common.sh34
4 files changed, 21 insertions, 16 deletions
diff --git a/resources/libraries/bash/entry/bootstrap_verify_perf.sh b/resources/libraries/bash/entry/bootstrap_verify_perf.sh
index 84e2c3211d..0b46ff1e57 100644
--- a/resources/libraries/bash/entry/bootstrap_verify_perf.sh
+++ b/resources/libraries/bash/entry/bootstrap_verify_perf.sh
@@ -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
diff --git a/resources/libraries/bash/entry/per_patch_device.sh b/resources/libraries/bash/entry/per_patch_device.sh
index 19137e982c..ac2c4a4ac5 100644
--- a/resources/libraries/bash/entry/per_patch_device.sh
+++ b/resources/libraries/bash/entry/per_patch_device.sh
@@ -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
diff --git a/resources/libraries/bash/entry/per_patch_perf.sh b/resources/libraries/bash/entry/per_patch_perf.sh
index 3569b21497..b5e7bb9117 100644
--- a/resources/libraries/bash/entry/per_patch_perf.sh
+++ b/resources/libraries/bash/entry/per_patch_perf.sh
@@ -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
diff --git a/resources/libraries/bash/function/common.sh b/resources/libraries/bash/function/common.sh
index 399b449fa0..02c65c82c2 100644
--- a/resources/libraries/bash/function/common.sh
+++ b/resources/libraries/bash/function/common.sh
@@ -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
}