Change collect to use /etc/platform/openrc

The collect tool is failing to source the openrc file
needed to execute system commands to get inventory.

The openrc file has been moved to /etc/platform but
collect expects it to be in /etc/nova.

This update changes collect to source openrc from
/etc/platform in collect_utils and avoids needless
sourcing of that same file multiple times from the
other collect scripts. All collect scripts source
collect_utils.

The update also removes reference to the also recently
removed keyring which is also breaking collect in the
very same way.

Test Plan:
Run collect on individual hosts
Run collect all

Change-Id: I75ff6d3cb8f25a9d0dca182837c7d1b4854896d9
Closes-Bug: 1820421
Signed-off-by: Eric MacDonald <eric.macdonald@windriver.com>
This commit is contained in:
Eric MacDonald 2019-03-17 15:36:15 -04:00
parent b250bf6e4c
commit 20fee68b1b
5 changed files with 14 additions and 48 deletions

View File

@ -1,2 +1,2 @@
SRC_DIR="scripts"
TIS_PATCH_VER=26
TIS_PATCH_VER=27

View File

@ -85,29 +85,6 @@ fi
# pull in common utils and environment
source /usr/local/sbin/collect_utils
# get the host type
nodetype=""
subfunction=""
PLATFORM_CONF=/etc/platform/platform.conf
if [ -e ${PLATFORM_CONF} ] ; then
source ${PLATFORM_CONF}
fi
ACTIVE=false
if [ "${nodetype}" == "controller" ] ; then
KEYRING_PATH="/opt/platform/.keyring"
if [ -e ${KEYRING_PATH} ] ; then
CRED=`find /opt/platform/.keyring -name .CREDENTIAL`
if [ ! -z "${CRED}" ] ; then
NOVAOPENRC="/etc/nova/openrc"
if [ -e ${NOVAOPENRC} ] ; then
ACTIVE=true
source ${NOVAOPENRC} 2>/dev/null 1>/dev/null
fi
fi
fi
fi
function clean_up()
{
`reset`

View File

@ -13,17 +13,6 @@
#
source /usr/local/sbin/collect_utils
KEYRING_PATH="/opt/platform/.keyring"
if [ -e ${KEYRING_PATH} ] ; then
CRED=`find /opt/platform/.keyring -name .CREDENTIAL`
if [ ! -z "${CRED}" ] ; then
NOVAOPENRC="/etc/nova/openrc"
if [ -e ${NOVAOPENRC} ] ; then
source ${NOVAOPENRC} 2>/dev/null 1>/dev/null
fi
fi
fi
#
# parse input parameters
#

View File

@ -63,7 +63,6 @@ done
find ${COLLECT_NAME_DIR} -name server-cert.pem | xargs --no-run-if-empty rm -f
rm -rf ${COLLECT_NAME_DIR}/var/extra/platform/config/*/ssh_config
rm -f ${COLLECT_NAME_DIR}/var/extra/platform/.keyring/*/python_keyring/crypted_pass.cfg
rm -f ${COLLECT_NAME_DIR}/var/extra/platform/puppet/*/hieradata/secure*.yaml
# Mask user passwords in sysinv db dump

View File

@ -55,18 +55,6 @@ MIN_PERCENT_SPACE_REQUIRED=75
COLLECT_LOG=/var/log/collect.log
COLLECT_ERROR_LOG=/tmp/collect_error.log
# Load up the nova openrc file if its possible
KEYRING_PATH="/opt/platform/.keyring"
if [ -e ${KEYRING_PATH} ] ; then
CRED=`find /opt/platform/.keyring -name .CREDENTIAL`
if [ ! -z "${CRED}" ] ; then
NOVAOPENRC="/etc/nova/openrc"
if [ -e ${NOVAOPENRC} ] ; then
ACTIVE=true
source ${NOVAOPENRC} 2>/dev/null 1>/dev/null
fi
fi
fi
# get the node and subfunction types
nodetype=""
@ -84,6 +72,19 @@ fi
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
fi
fi
fi
# Setup an expect command completion file.
# This is used to force serialization of expect
# sequences and highlight command completion