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
| ... | ... |
@@ -26,6 +26,11 @@ source $RC_DIR/functions |
| 26 | 26 |
# Load local configuration |
| 27 | 27 |
source $RC_DIR/stackrc |
| 28 | 28 |
|
| 29 |
+# Load the last env variables if available |
|
| 30 |
+if [[ -r $TOP_DIR/.stackenv ]]; then |
|
| 31 |
+ source $TOP_DIR/.stackenv |
|
| 32 |
+fi |
|
| 33 |
+ |
|
| 29 | 34 |
# Get some necessary configuration |
| 30 | 35 |
source $RC_DIR/lib/tls |
| 31 | 36 |
|
| ... | ... |
@@ -90,6 +90,11 @@ DEST=${DEST:-/opt/stack}
|
| 90 | 90 |
# Sanity Check |
| 91 | 91 |
# ============ |
| 92 | 92 |
|
| 93 |
+# Clean up last environment var cache |
|
| 94 |
+if [[ -r $TOP_DIR/.stackenv ]]; then |
|
| 95 |
+ rm $TOP_DIR/.stackenv |
|
| 96 |
+fi |
|
| 97 |
+ |
|
| 93 | 98 |
# Import database configuration |
| 94 | 99 |
source $TOP_DIR/lib/database |
| 95 | 100 |
|
| ... | ... |
@@ -537,9 +542,9 @@ function echo_nolog() {
|
| 537 | 537 |
# Set ``LOGFILE`` to turn on logging |
| 538 | 538 |
# Append '.xxxxxxxx' to the given name to maintain history |
| 539 | 539 |
# where 'xxxxxxxx' is a representation of the date the file was created |
| 540 |
+TIMESTAMP_FORMAT=${TIMESTAMP_FORMAT:-"%F-%H%M%S"}
|
|
| 540 | 541 |
if [[ -n "$LOGFILE" || -n "$SCREEN_LOGDIR" ]]; then |
| 541 | 542 |
LOGDAYS=${LOGDAYS:-7}
|
| 542 |
- TIMESTAMP_FORMAT=${TIMESTAMP_FORMAT:-"%F-%H%M%S"}
|
|
| 543 | 543 |
CURRENT_LOG_TIME=$(date "+$TIMESTAMP_FORMAT") |
| 544 | 544 |
fi |
| 545 | 545 |
|
| ... | ... |
@@ -1705,6 +1710,14 @@ if is_service_enabled tempest; then |
| 1705 | 1705 |
echo '**************************************************' |
| 1706 | 1706 |
fi |
| 1707 | 1707 |
|
| 1708 |
+# Save some values we generated for later use |
|
| 1709 |
+CURRENT_RUN_TIME=$(date "+$TIMESTAMP_FORMAT") |
|
| 1710 |
+echo "# $CURRENT_RUN_TIME" >$TOP_DIR/.stackenv |
|
| 1711 |
+for i in BASE_SQL_CONN ENABLED_SERVICES HOST_IP LOGFILE \ |
|
| 1712 |
+ SERVICE_HOST SERVICE_PROTOCOL TLS_IP; do |
|
| 1713 |
+ echo $i=${!i} >>$TOP_DIR/.stackenv
|
|
| 1714 |
+done |
|
| 1715 |
+ |
|
| 1708 | 1716 |
|
| 1709 | 1717 |
# Run local script |
| 1710 | 1718 |
# ================ |