#!/bin/bash

group=$1
testName="OSI"
testSummary="baseproduct matches SLES for SAP Applications"

source ../get_test_values --group=$group
vName=$ascsVNAME

function test()
{
    local system=$1
    timeout 10 ssh -T root@$system <<EOF
       fgrep -q "<name>SLES_SAP</name>" /etc/products.d/baseproduct 2>/dev/null;
EOF
    return $?
}


for system in $allSystems; do
    test $system; rc=$?
    logger -t $LandscapeUseCase -s "Test $testName for $group on node $system rc:  $rc"
    case $rc in 
        124 | 255 ) # test timeout - set N/A
             rm -f $STATUS_BASE_DIR/.status/${group}_${testName}_OK
             rm -f $STATUS_BASE_DIR/.status/${group}_${testName}_FAIL
             res="NA";
             ;;
        0 )
             touch $STATUS_BASE_DIR/.status/${group}_${testName}_OK
             rm -f $STATUS_BASE_DIR/.status/${group}_${testName}_FAIL
             # we do not break to scan all systems
             ;;
        *   ) rm -f $STATUS_BASE_DIR/.status/${group}_${testName}_OK
             touch $STATUS_BASE_DIR/.status/${group}_${testName}_FAIL
             ;;
    esac
done
