Whamcloud - gitweb
LU-13969 - Updates to lustre-release yaml.sh 52/39952/5 master
authorLee Ochoa <lochoa@whamcloud.com>
Wed, 16 Sep 2020 21:02:33 +0000 (15:02 -0600)
committerOleg Drokin <green@whamcloud.com>
Fri, 25 Sep 2020 03:13:24 +0000 (03:13 +0000)
Updated output of release() function to standarize node.yml file
os_distribution parameter. Changes as follows:

RHEL   - use redhat-release first and os-release as backup as the latter may
         not include the full version (major/minor)
CENTOS - use centos-release first and os-release as backup, same as RHEL
SUSE   - use os-release instead of suse-release as the latter is deprecated
UBUNTU - use os-release

Removed parsing system-release and *-release as neither
option correctly outputs desired info

Removed "lustre_" references in node.yml file attributes, the default in Maloo
is to look for non-lustre prefixes first

Change-Id: Ia011f944aae53f31fcd3a539e846ea5aba7ec7c4
Signed-off-by: Lee Ochoa <lochoa@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/39952
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/yaml.sh

index c84db5c..bd08571 100644 (file)
@@ -75,24 +75,19 @@ yml_code_review() {
 }
 
 release() {
-       if [ -r /etc/SuSE-release ]; then
-               name=$(awk '/SUSE/ { printf("%s %s %s %s", $1, $2, $3, $4) }' \
-                       /etc/SuSE-release)
-               version=$(sed -n -e 's/^VERSION = //p' /etc/SuSE-release)
-               level=$(sed -n -e 's/^PATCHLEVEL = //p' /etc/SuSE-release)
-               dist="${name} ${version}.${level}"
+       rhel_pat=".*release \([[:digit:]]\+\.[[:digit:]]\+\).*"
+
+       if [ -r /etc/centos-release ]; then
+               version=$(sed -n -e "s/${rhel_pat}/\1/p" /etc/centos-release)
+               dist="CentOS ${version}"
+       elif [ -r /etc/redhat-release ]; then
+               version=$(sed -n -e "s/${rhel_pat}/\1/p" /etc/redhat-release)
+               dist="RHEL ${version}"
        elif [ -r /etc/os-release ]; then
                name=$(sed -n -e 's/"//g' -e 's/^NAME=//p' /etc/os-release)
                version=$(sed -n -e 's/"//g' -e 's/^VERSION_ID=//p' \
-                       /etc/os-release)
+               /etc/os-release)
                dist="${name} ${version}"
-       elif [ -r /etc/system-release ]; then
-               dist=$(awk '/release/ \
-                       { printf("%s %s %s", $1, $2, $3) }' \
-                       /etc/system-release)
-       elif [ -r /etc/*-release ]; then
-               dist=$(find /etc/ -maxdepth 1 -name '*release' 2> /dev/null | \
-                       sed -e 's/\/etc\///' -e 's/-release//' | head -n1)
        else
                dist="UNKNOWN"
        fi
@@ -112,10 +107,10 @@ cat <<EOF
     architecture: $(uname -m)
     os: $(uname -o)
     os_distribution: $TEST_DISTRO
-    lustre_version: $LUSTRE_VERSION
-    lustre_build: $LUSTRE_BUILD
-    lustre_branch: $LUSTRE_BRANCH
-    lustre_revision: $LUSTRE_REVISION
+    version: $LUSTRE_VERSION
+    build: $LUSTRE_BUILD
+    branch: $LUSTRE_BRANCH
+    revision: $LUSTRE_REVISION
     kernel_version: $(uname -r)
     file_system: ${FILE_SYSTEM:-"NA"}
 EOF