Write selected env variables to .stackenv

There are some environment variables that are derived in stack.sh
and cubersome to re-create later, so save them at the end of stack.sh
for use by other supporting scripts, such as openrc.

Change-Id: I1bbf717b970f8ceac0ff7da74aeaf19474997e07
This commit is contained in:
Dean Troyer 2012-12-10 16:47:36 -06:00
parent 60ffc61650
commit 33cb43034e
2 changed files with 19 additions and 1 deletions

5
openrc
View File

@ -26,6 +26,11 @@ source $RC_DIR/functions
# Load local configuration # Load local configuration
source $RC_DIR/stackrc 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 # Get some necessary configuration
source $RC_DIR/lib/tls source $RC_DIR/lib/tls

View File

@ -90,6 +90,11 @@ DEST=${DEST:-/opt/stack}
# Sanity Check # Sanity Check
# ============ # ============
# Clean up last environment var cache
if [[ -r $TOP_DIR/.stackenv ]]; then
rm $TOP_DIR/.stackenv
fi
# Import database configuration # Import database configuration
source $TOP_DIR/lib/database source $TOP_DIR/lib/database
@ -537,9 +542,9 @@ function echo_nolog() {
# Set ``LOGFILE`` to turn on logging # Set ``LOGFILE`` to turn on logging
# Append '.xxxxxxxx' to the given name to maintain history # Append '.xxxxxxxx' to the given name to maintain history
# where 'xxxxxxxx' is a representation of the date the file was created # 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 if [[ -n "$LOGFILE" || -n "$SCREEN_LOGDIR" ]]; then
LOGDAYS=${LOGDAYS:-7} LOGDAYS=${LOGDAYS:-7}
TIMESTAMP_FORMAT=${TIMESTAMP_FORMAT:-"%F-%H%M%S"}
CURRENT_LOG_TIME=$(date "+$TIMESTAMP_FORMAT") CURRENT_LOG_TIME=$(date "+$TIMESTAMP_FORMAT")
fi fi
@ -1705,6 +1710,14 @@ if is_service_enabled tempest; then
echo '**************************************************' echo '**************************************************'
fi 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 # Run local script
# ================ # ================