
Currently, we use a simple logic for the client scripts to find libraries, configuration files, etc. We know they will be copied to the autostart directory from where TOP_DIR is one step up. If a user ever tried to run a script in its original location (e.g. in scripts/ubuntu), this logic would fail. This has been a theoretical problem as long as users just used osbash.sh or st.py to run the scripts. But if users would like to run extra scripts, logging in to the nodes and running the scripts where they find them would be the most natural way to do it. Right now, the main use case is the heat service which is not installed by default but can be installed at a later time if so desired -- with the gotcha described above. As more services are becoming optional add-ons to the install-guide, this becomes an issue. This patch installs a new logic: if a script finds a file named TOP_DIR in its parent dir, it will use the file's contents as a pointer to the TOP_DIR location. TOP_DIR is a file rather than a symlink because the file needs to work on Windows file systems as well. The file lives in the parent directory rather than the script directory because that reduces the number of such files that are required. This becomes more relevant once we store additional services along with their supporting files in extras/<service_name>/. Change-Id: Ib0ccb108e5246ff8e06d87730ce11704d719fb75
29 lines
878 B
Bash
Executable File
29 lines
878 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -o errexit -o nounset
|
|
TOP_DIR=$(cd $(cat "../TOP_DIR"||echo $(dirname "$0"))/.. && pwd)
|
|
source "$TOP_DIR/config/paths"
|
|
source "$LIB_DIR/functions.guest.sh"
|
|
|
|
indicate_current_auto
|
|
|
|
exec_logfile
|
|
|
|
# The install-guide wants to use the hostname as the name of the interface
|
|
# in the mgmt network. We cannot allow 127.0.0.1 to share the name.
|
|
HOST_NAME=$(hostname)-lo
|
|
HOST_FILE=/etc/hosts
|
|
|
|
if ! grep -q "^[^#].*$HOST_NAME" $HOST_FILE; then
|
|
# No active entry for our hostname
|
|
HOST_IP=127.0.1.1
|
|
if grep -q "^$HOST_IP" $HOST_FILE; then
|
|
# Fix the entry for the IP address we want to use
|
|
sudo sed -i "s/^$HOST_IP.*/$HOST_IP $HOST_NAME/" $HOST_FILE
|
|
else
|
|
echo "$HOST_IP $HOST_NAME" | sudo tee -a $HOST_FILE
|
|
fi
|
|
fi
|
|
|
|
# Add entries for the OpenStack training-labs cluster
|
|
cat "$CONFIG_DIR/hosts.multi" | sudo tee -a /etc/hosts
|