Skip to content

Commit 0e8dced

Browse files
author
Dean Troyer
committed
Re-order stack.sh 2: target dir setup
Part 2 of a series Re-order the setup and check bits in the top portion of stack.sh to have a logical flow with similar things done together. No behaviour changes are intended aside from the order of execution. Any such changes are bugs. * Consolidate DEST dir setup * Move rpc & database init to just before project init Change-Id: I2af1d4ed32ec34417c04592bf94fe645bb97f831
1 parent d3bf9bd commit 0e8dced

1 file changed

Lines changed: 26 additions & 19 deletions

File tree

stack.sh

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fi
109109

110110

111111
# Global Settings
112-
# ===============
112+
# ---------------
113113

114114
# Check for a ``localrc`` section embedded in ``local.conf`` and extract if
115115
# ``localrc`` does not already exist
@@ -165,20 +165,11 @@ source $TOP_DIR/stackrc
165165
# Make sure the proxy config is visible to sub-processes
166166
export_proxy_variables
167167

168-
# Destination path for installation ``DEST``
169-
DEST=${DEST:-/opt/stack}
170-
171-
172-
# Import common services (database, message queue) configuration
173-
source $TOP_DIR/lib/database
174-
source $TOP_DIR/lib/rpc_backend
175-
176168
# Remove services which were negated in ENABLED_SERVICES
177169
# using the "-" prefix (e.g., "-rabbit") instead of
178170
# calling disable_service().
179171
disable_negated_services
180172

181-
182173
# Look for obsolete stuff
183174
if [[ ,${ENABLED_SERVICES}, =~ ,"swift", ]]; then
184175
echo "FATAL: 'swift' is not supported as a service name"
@@ -187,6 +178,8 @@ if [[ ,${ENABLED_SERVICES}, =~ ,"swift", ]]; then
187178
exit 1
188179
fi
189180

181+
# Set up logging level
182+
VERBOSE=$(trueorfalse True $VERBOSE)
190183

191184
# Configure sudo
192185
# --------------
@@ -209,8 +202,9 @@ chmod 0440 $TEMPFILE
209202
sudo chown root:root $TEMPFILE
210203
sudo mv $TEMPFILE /etc/sudoers.d/50_stack_sh
211204

212-
# Additional repos
213-
# ----------------
205+
206+
# Configure Distro Repositories
207+
# -----------------------------
214208

215209
# For debian/ubuntu make apt attempt to retry network ops on it's own
216210
if is_ubuntu; then
@@ -252,8 +246,12 @@ if [[ is_fedora && $DISTRO =~ (rhel) ]]; then
252246

253247
fi
254248

255-
# Filesystem setup
256-
# ----------------
249+
250+
# Configure Target Directories
251+
# ----------------------------
252+
253+
# Destination path for installation ``DEST``
254+
DEST=${DEST:-/opt/stack}
257255

258256
# Create the destination directory and ensure it is writable by the user
259257
# and read/executable by everybody for daemons (e.g. apache run for horizon)
@@ -264,18 +262,19 @@ safe_chmod 0755 $DEST
264262
# a basic test for $DEST path permissions (fatal on error unless skipped)
265263
check_path_perm_sanity ${DEST}
266264

265+
# Destination path for service data
266+
DATA_DIR=${DATA_DIR:-${DEST}/data}
267+
sudo mkdir -p $DATA_DIR
268+
safe_chown -R $STACK_USER $DATA_DIR
269+
270+
# Configure proper hostname
267271
# Certain services such as rabbitmq require that the local hostname resolves
268272
# correctly. Make sure it exists in /etc/hosts so that is always true.
269273
LOCAL_HOSTNAME=`hostname -s`
270274
if [ -z "`grep ^127.0.0.1 /etc/hosts | grep $LOCAL_HOSTNAME`" ]; then
271275
sudo sed -i "s/\(^127.0.0.1.*\)/\1 $LOCAL_HOSTNAME/" /etc/hosts
272276
fi
273277

274-
# Destination path for service data
275-
DATA_DIR=${DATA_DIR:-${DEST}/data}
276-
sudo mkdir -p $DATA_DIR
277-
safe_chown -R $STACK_USER $DATA_DIR
278-
279278

280279
# Common Configuration
281280
# --------------------
@@ -327,6 +326,14 @@ SERVICE_TIMEOUT=${SERVICE_TIMEOUT:-60}
327326
SSL_BUNDLE_FILE="$DATA_DIR/ca-bundle.pem"
328327
rm -f $SSL_BUNDLE_FILE
329328

329+
# Import common services (database, message queue) configuration
330+
source $TOP_DIR/lib/database
331+
source $TOP_DIR/lib/rpc_backend
332+
333+
# Make sure we only have one rpc backend enabled,
334+
# and the specified rpc backend is available on your platform.
335+
check_rpc_backend
336+
330337

331338
# Configure Projects
332339
# ==================

0 commit comments

Comments
 (0)