diff --git a/tools/collector/centos/build_srpm.data b/tools/collector/centos/build_srpm.data index 16277404..9add1c8b 100644 --- a/tools/collector/centos/build_srpm.data +++ b/tools/collector/centos/build_srpm.data @@ -1,2 +1,2 @@ SRC_DIR="scripts" -TIS_PATCH_VER=27 +TIS_PATCH_VER=28 diff --git a/tools/collector/scripts/collect b/tools/collector/scripts/collect index 5d50dbc9..88e373ea 100755 --- a/tools/collector/scripts/collect +++ b/tools/collector/scripts/collect @@ -84,6 +84,7 @@ fi # pull in common utils and environment source /usr/local/sbin/collect_utils +source_openrc_if_needed function clean_up() { diff --git a/tools/collector/scripts/collect_host b/tools/collector/scripts/collect_host index 3faf250e..da927d16 100755 --- a/tools/collector/scripts/collect_host +++ b/tools/collector/scripts/collect_host @@ -12,6 +12,7 @@ # all collectors ; common and user defined. # source /usr/local/sbin/collect_utils +source_openrc_if_needed # # parse input parameters diff --git a/tools/collector/scripts/collect_utils b/tools/collector/scripts/collect_utils index 66c9a3ac..b211fcef 100755 --- a/tools/collector/scripts/collect_utils +++ b/tools/collector/scripts/collect_utils @@ -55,34 +55,37 @@ MIN_PERCENT_SPACE_REQUIRED=75 COLLECT_LOG=/var/log/collect.log COLLECT_ERROR_LOG=/tmp/collect_error.log +function source_openrc_if_needed +{ + # get the node and subfunction types + nodetype="" + subfunction="" + PLATFORM_CONF=/etc/platform/platform.conf + if [ -e ${PLATFORM_CONF} ] ; then + source ${PLATFORM_CONF} + fi -# get the node and subfunction types -nodetype="" -subfunction="" -PLATFORM_CONF=/etc/platform/platform.conf -if [ -e ${PLATFORM_CONF} ] ; then - source ${PLATFORM_CONF} -fi + if [ "${nodetype}" != "controller" -a "${nodetype}" != "worker" -a "${nodetype}" != "storage" ] ; then + logger -t ${COLLECT_TAG} "could not identify nodetype ($nodetype)" + exit $FAIL_NODETYPE + fi -if [ "${nodetype}" != "controller" -a "${nodetype}" != "worker" -a "${nodetype}" != "storage" ] ; then - logger -t ${COLLECT_TAG} "could not identify nodetype ($nodetype)" - exit $FAIL_NODETYPE -fi + NODETYPE=$nodetype + SUBFUNCTION=$subfunction -NODETYPE=$nodetype -SUBFUNCTION=$subfunction - -ACTIVE=false -if [ "$NODETYPE" == "controller" ] ; then - # get local host activity state - OPENRC="/etc/platform/openrc" - if [ -e "${OPENRC}" ] ; then - rc=`source ${OPENRC}` - if [ "$rc" == "" ] ; then - ACTIVE=true + ACTIVE=false + if [ "$NODETYPE" == "controller" ] ; then + # get local host activity state + OPENRC="/etc/platform/openrc" + if [ -e "${OPENRC}" ] ; then + OS_USERNAME="" + source ${OPENRC} + if [ "${OS_USERNAME}" != "" ] ; then + ACTIVE=true + fi fi fi -fi +} # Setup an expect command completion file.