From 6816234dc84b3e81a3de8745e84691d09123ba7f Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Wed, 13 May 2015 15:41:03 -0500 Subject: [PATCH] Save stackenv values more often Having these for debugging can be handy Change-Id: I18c2658eec83a0f20f697a3c4c36aa1cf46b7a92 --- functions-common | 20 ++++++++++++++++++++ stack.sh | 13 +++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/functions-common b/functions-common index 52d80fb95b..974f5934e4 100644 --- a/functions-common +++ b/functions-common @@ -43,6 +43,25 @@ declare -A GITDIR TRACK_DEPENDS=${TRACK_DEPENDS:-False} +# Save these variables to .stackenv +STACK_ENV_VARS="BASE_SQL_CONN DATA_DIR DEST ENABLED_SERVICES HOST_IP \ + KEYSTONE_AUTH_PROTOCOL KEYSTONE_AUTH_URI KEYSTONE_SERVICE_URI \ + LOGFILE OS_CACERT SERVICE_HOST SERVICE_PROTOCOL STACK_USER TLS_IP" + + +# Saves significant environment variables to .stackenv for later use +# Refers to a lot of globals, only TOP_DIR and STACK_ENV_VARS are required to +# function, the rest are simply saved and do not cause problems if they are undefined. +# save_stackenv [tag] +function save_stackenv { + local tag=${1:-""} + # Save some values we generated for later use + time_stamp=$(date "+$TIMESTAMP_FORMAT") + echo "# $time_stamp $tag" >$TOP_DIR/.stackenv + for i in $STACK_ENV_VARS; do + echo $i=${!i} >>$TOP_DIR/.stackenv + done +} # Normalize config values to True or False # Accepts as False: 0 no No NO false False FALSE @@ -68,6 +87,7 @@ function isset { [[ -v "$1" ]] } + # Control Functions # ================= diff --git a/stack.sh b/stack.sh index f0aafafb3a..4f7a805f3f 100755 --- a/stack.sh +++ b/stack.sh @@ -669,6 +669,9 @@ if is_service_enabled s-proxy; then fi fi +# Save configuration values +save_stackenv $LINENO + # Install Packages # ================ @@ -950,6 +953,9 @@ fi # Initialize the directory for service status check init_service_check +# Save configuration values +save_stackenv $LINENO + # Start Services # ============== @@ -1294,12 +1300,7 @@ fi # Save some values we generated for later use -CURRENT_RUN_TIME=$(date "+$TIMESTAMP_FORMAT") -echo "# $CURRENT_RUN_TIME" >$TOP_DIR/.stackenv -for i in BASE_SQL_CONN ENABLED_SERVICES HOST_IP LOGFILE \ - SERVICE_HOST SERVICE_PROTOCOL STACK_USER TLS_IP KEYSTONE_AUTH_PROTOCOL OS_CACERT; do - echo $i=${!i} >>$TOP_DIR/.stackenv -done +save_stackenv # Wrapup configuration