From adda44b54ea0e0535e330ed4c38c1ed4105ad43d Mon Sep 17 00:00:00 2001 From: Eric MacDonald Date: Tue, 13 Aug 2019 11:16:10 -0400 Subject: [PATCH] Make platform.conf variables visible to collect.d service scripts A number of collect.d service scripts are not gathering all the info that is needed during the collect operation. Many collect.d service scripts use nodetype, subfunction, vswitch_type and other platform.conf variables to determine what to collect. However, these variables are seen to be empty causing the service scripts to make incorrect collection decisions. This update modifies the scoping of loaded platform.conf variables so that they are visible to all of collect, including the collect.d service scripts. Test Plan: PASS: Verify platform.conf variables are visible to collect.d service scripts. PASS: Verify file list before and after update. PASS: Run collect all and verify missing content present. PASS: Run collect host and verify missing content present. Change-Id: Ia6f45afd3f3fc676b0d3eaca16dc8bbe68356c8e Closes-Bug: 1839389 --- tools/collector/centos/build_srpm.data | 2 +- tools/collector/scripts/collect_host | 17 ++++++++++++++++- tools/collector/scripts/collect_utils | 7 ++----- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/tools/collector/centos/build_srpm.data b/tools/collector/centos/build_srpm.data index a9d3f505b..abb9f2e28 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=29 +TIS_PATCH_VER=30 diff --git a/tools/collector/scripts/collect_host b/tools/collector/scripts/collect_host index 46cdb5ce3..e94177ac1 100755 --- a/tools/collector/scripts/collect_host +++ b/tools/collector/scripts/collect_host @@ -1,12 +1,27 @@ #! /bin/bash ######################################################################## # -# Copyright (c) 2016 Wind River Systems, Inc. +# Copyright (c) 2016-2019 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # ######################################################################## +# make these platform.conf variables global. +# values are loaded in source_openrc_if_needed. +export nodetype="" +export subfunction="" +export system_type="" +export security_profile="" +export sdn_enabled="" +export region_config="" +export vswitch_type="" +export system_mode="" +export sw_version="" + +# assume this is not the active controller until learned +export ACTIVE=false + # # Import commands, variables and convenience functions available to # all collectors ; common and user defined. diff --git a/tools/collector/scripts/collect_utils b/tools/collector/scripts/collect_utils index b211fcefc..195b22e7c 100755 --- a/tools/collector/scripts/collect_utils +++ b/tools/collector/scripts/collect_utils @@ -1,6 +1,6 @@ #! /bin/bash # -# Copyright (c) 2013-2014 Wind River Systems, Inc. +# Copyright (c) 2013-2019 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -70,11 +70,8 @@ function source_openrc_if_needed exit $FAIL_NODETYPE fi - NODETYPE=$nodetype - SUBFUNCTION=$subfunction - ACTIVE=false - if [ "$NODETYPE" == "controller" ] ; then + if [ "$nodetype" == "controller" ] ; then # get local host activity state OPENRC="/etc/platform/openrc" if [ -e "${OPENRC}" ] ; then