diff --git a/openrc b/openrc index 2553b4aa1c..3ef44fd151 100644 --- a/openrc +++ b/openrc @@ -26,6 +26,11 @@ source $RC_DIR/functions # Load local configuration source $RC_DIR/stackrc +# Load the last env variables if available +if [[ -r $TOP_DIR/.stackenv ]]; then + source $TOP_DIR/.stackenv +fi + # Get some necessary configuration source $RC_DIR/lib/tls diff --git a/stack.sh b/stack.sh index 94403fcc3f..cf638e837c 100755 --- a/stack.sh +++ b/stack.sh @@ -90,6 +90,11 @@ DEST=${DEST:-/opt/stack} # Sanity Check # ============ +# Clean up last environment var cache +if [[ -r $TOP_DIR/.stackenv ]]; then + rm $TOP_DIR/.stackenv +fi + # Import database configuration source $TOP_DIR/lib/database @@ -537,9 +542,9 @@ function echo_nolog() { # Set ``LOGFILE`` to turn on logging # Append '.xxxxxxxx' to the given name to maintain history # where 'xxxxxxxx' is a representation of the date the file was created +TIMESTAMP_FORMAT=${TIMESTAMP_FORMAT:-"%F-%H%M%S"} if [[ -n "$LOGFILE" || -n "$SCREEN_LOGDIR" ]]; then LOGDAYS=${LOGDAYS:-7} - TIMESTAMP_FORMAT=${TIMESTAMP_FORMAT:-"%F-%H%M%S"} CURRENT_LOG_TIME=$(date "+$TIMESTAMP_FORMAT") fi @@ -1706,6 +1711,14 @@ if is_service_enabled tempest; then echo '**************************************************' 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 TLS_IP; do + echo $i=${!i} >>$TOP_DIR/.stackenv +done + # Run local script # ================