From a4643ee26933eb91ccda01c58dee6162586d9827 Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Wed, 18 May 2016 12:09:12 -0400 Subject: [PATCH] Use mapping to determine system type Change-Id: I00179300fee6acbf78ffdc72c6773552df87b748 Signed-off-by: Thanh Ha --- jenkins-scripts/system_type.sh | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/jenkins-scripts/system_type.sh b/jenkins-scripts/system_type.sh index 201f34f9a..4d8c8c770 100755 --- a/jenkins-scripts/system_type.sh +++ b/jenkins-scripts/system_type.sh @@ -13,24 +13,18 @@ HOST=$(/usr/bin/hostname) SYSTEM_TYPE='' -# We use a separator character of - for the slave parts -IFS='-' read -r -a HOSTPARTS <<< "${HOST}" - -# slurp in the control scripts -FILES=($(find . -maxdepth 1 -type f -iname '*.sh' -exec basename -s '.sh' {} \;)) -# remap into an associative array -declare -A A_FILES -for key in "${!FILES[@]}" -do - A_FILES[${FILES[$key]}]="${key}" -done - -# Find our system_type control script if possible -for i in "${HOSTPARTS[@]}" -do - if [ "${A_FILES[${i}]}" != "" ] - then - SYSTEM_TYPE=${i} +IFS=',' +for i in "autorelease,autorelease" \ + "builder,builder" \ + "devstack,devstack" \ + "docker,docker" \ + "java,controller" \ + "matrix,matrix" \ + "robot,robot" \ + "ubuntu-trusty-mininet,ubuntu-mininet" +do set -- $i + if [[ $HOST == *"$1"* ]]; then + SYSTEM_TYPE="$2" break fi done -- 2.36.6