|
...
|
...
|
@@ -165,9 +165,42 @@ fi
|
|
165
|
165
|
# Set up logging level
|
|
166
|
166
|
VERBOSE=$(trueorfalse True $VERBOSE)
|
|
167
|
167
|
|
|
|
168
|
+# root Access
|
|
|
169
|
+# -----------
|
|
|
170
|
+
|
|
|
171
|
+# OpenStack is designed to be run as a non-root user; Horizon will fail to run
|
|
|
172
|
+# as **root** since Apache will not serve content from **root** user).
|
|
|
173
|
+# ``stack.sh`` must not be run as **root**. It aborts and suggests one course of
|
|
|
174
|
+# action to create a suitable user account.
|
|
|
175
|
+
|
|
|
176
|
+if [[ $EUID -eq 0 ]]; then
|
|
|
177
|
+ echo "You are running this script as root."
|
|
|
178
|
+ echo "Cut it out."
|
|
|
179
|
+ echo "Really."
|
|
|
180
|
+ echo "If you need an account to run DevStack, do this (as root, heh) to create $STACK_USER:"
|
|
|
181
|
+ echo "$TOP_DIR/tools/create-stack-user.sh"
|
|
|
182
|
+ exit 1
|
|
|
183
|
+fi
|
|
|
184
|
+
|
|
|
185
|
+# We're not **root**, make sure ``sudo`` is available
|
|
|
186
|
+is_package_installed sudo || install_package sudo
|
|
|
187
|
+
|
|
|
188
|
+# UEC images ``/etc/sudoers`` does not have a ``#includedir``, add one
|
|
|
189
|
+sudo grep -q "^#includedir.*/etc/sudoers.d" /etc/sudoers ||
|
|
|
190
|
+ echo "#includedir /etc/sudoers.d" | sudo tee -a /etc/sudoers
|
|
|
191
|
+
|
|
|
192
|
+# Set up devstack sudoers
|
|
|
193
|
+TEMPFILE=`mktemp`
|
|
|
194
|
+echo "$STACK_USER ALL=(root) NOPASSWD:ALL" >$TEMPFILE
|
|
|
195
|
+# Some binaries might be under /sbin or /usr/sbin, so make sure sudo will
|
|
|
196
|
+# see them by forcing PATH
|
|
|
197
|
+echo "Defaults:$STACK_USER secure_path=/sbin:/usr/sbin:/usr/bin:/bin:/usr/local/sbin:/usr/local/bin" >> $TEMPFILE
|
|
|
198
|
+chmod 0440 $TEMPFILE
|
|
|
199
|
+sudo chown root:root $TEMPFILE
|
|
|
200
|
+sudo mv $TEMPFILE /etc/sudoers.d/50_stack_sh
|
|
168
|
201
|
|
|
169
|
202
|
# Additional repos
|
|
170
|
|
-# ================
|
|
|
203
|
+# ----------------
|
|
171
|
204
|
|
|
172
|
205
|
# Some distros need to add repos beyond the defaults provided by the vendor
|
|
173
|
206
|
# to pick up required packages.
|
|
...
|
...
|
@@ -200,45 +233,13 @@ if [[ is_fedora && $DISTRO =~ (rhel6) ]]; then
|
|
200
|
200
|
fi
|
|
201
|
201
|
|
|
202
|
202
|
# ... and also optional to be enabled
|
|
|
203
|
+ is_package_installed yum-utils || install_package yum-utils
|
|
203
|
204
|
sudo yum-config-manager --enable rhel-6-server-optional-rpms
|
|
204
|
205
|
|
|
205
|
206
|
fi
|
|
206
|
207
|
|
|
207
|
|
-
|
|
208
|
|
-# root Access
|
|
209
|
|
-# -----------
|
|
210
|
|
-
|
|
211
|
|
-# OpenStack is designed to be run as a non-root user; Horizon will fail to run
|
|
212
|
|
-# as **root** since Apache will not serve content from **root** user).
|
|
213
|
|
-# ``stack.sh`` must not be run as **root**. It aborts and suggests one course of
|
|
214
|
|
-# action to create a suitable user account.
|
|
215
|
|
-
|
|
216
|
|
-if [[ $EUID -eq 0 ]]; then
|
|
217
|
|
- echo "You are running this script as root."
|
|
218
|
|
- echo "Cut it out."
|
|
219
|
|
- echo "Really."
|
|
220
|
|
- echo "If you need an account to run DevStack, do this (as root, heh) to create $STACK_USER:"
|
|
221
|
|
- echo "$TOP_DIR/tools/create-stack-user.sh"
|
|
222
|
|
- exit 1
|
|
223
|
|
-fi
|
|
224
|
|
-
|
|
225
|
|
-# We're not **root**, make sure ``sudo`` is available
|
|
226
|
|
-is_package_installed sudo || install_package sudo
|
|
227
|
|
-
|
|
228
|
|
-# UEC images ``/etc/sudoers`` does not have a ``#includedir``, add one
|
|
229
|
|
-sudo grep -q "^#includedir.*/etc/sudoers.d" /etc/sudoers ||
|
|
230
|
|
- echo "#includedir /etc/sudoers.d" | sudo tee -a /etc/sudoers
|
|
231
|
|
-
|
|
232
|
|
-# Set up devstack sudoers
|
|
233
|
|
-TEMPFILE=`mktemp`
|
|
234
|
|
-echo "$STACK_USER ALL=(root) NOPASSWD:ALL" >$TEMPFILE
|
|
235
|
|
-# Some binaries might be under /sbin or /usr/sbin, so make sure sudo will
|
|
236
|
|
-# see them by forcing PATH
|
|
237
|
|
-echo "Defaults:$STACK_USER secure_path=/sbin:/usr/sbin:/usr/bin:/bin:/usr/local/sbin:/usr/local/bin" >> $TEMPFILE
|
|
238
|
|
-chmod 0440 $TEMPFILE
|
|
239
|
|
-sudo chown root:root $TEMPFILE
|
|
240
|
|
-sudo mv $TEMPFILE /etc/sudoers.d/50_stack_sh
|
|
241
|
|
-
|
|
|
208
|
+# Filesystem setup
|
|
|
209
|
+# ----------------
|
|
242
|
210
|
|
|
243
|
211
|
# Create the destination directory and ensure it is writable by the user
|
|
244
|
212
|
# and read/executable by everybody for daemons (e.g. apache run for horizon)
|
|
...
|
...
|
@@ -256,6 +257,15 @@ if [ -z "`grep ^127.0.0.1 /etc/hosts | grep $LOCAL_HOSTNAME`" ]; then
|
|
256
|
256
|
sudo sed -i "s/\(^127.0.0.1.*\)/\1 $LOCAL_HOSTNAME/" /etc/hosts
|
|
257
|
257
|
fi
|
|
258
|
258
|
|
|
|
259
|
+# Destination path for service data
|
|
|
260
|
+DATA_DIR=${DATA_DIR:-${DEST}/data}
|
|
|
261
|
+sudo mkdir -p $DATA_DIR
|
|
|
262
|
+safe_chown -R $STACK_USER $DATA_DIR
|
|
|
263
|
+
|
|
|
264
|
+
|
|
|
265
|
+# Common Configuration
|
|
|
266
|
+# --------------------
|
|
|
267
|
+
|
|
259
|
268
|
# Set ``OFFLINE`` to ``True`` to configure ``stack.sh`` to run cleanly without
|
|
260
|
269
|
# Internet access. ``stack.sh`` must have been previously run with Internet
|
|
261
|
270
|
# access to install prerequisites and fetch repositories.
|
|
...
|
...
|
@@ -269,15 +279,6 @@ ERROR_ON_CLONE=`trueorfalse False $ERROR_ON_CLONE`
|
|
269
|
269
|
# Whether to enable the debug log level in OpenStack services
|
|
270
|
270
|
ENABLE_DEBUG_LOG_LEVEL=`trueorfalse True $ENABLE_DEBUG_LOG_LEVEL`
|
|
271
|
271
|
|
|
272
|
|
-# Destination path for service data
|
|
273
|
|
-DATA_DIR=${DATA_DIR:-${DEST}/data}
|
|
274
|
|
-sudo mkdir -p $DATA_DIR
|
|
275
|
|
-safe_chown -R $STACK_USER $DATA_DIR
|
|
276
|
|
-
|
|
277
|
|
-
|
|
278
|
|
-# Common Configuration
|
|
279
|
|
-# ====================
|
|
280
|
|
-
|
|
281
|
272
|
# Set fixed and floating range here so we can make sure not to use addresses
|
|
282
|
273
|
# from either range when attempting to guess the IP to use for the host.
|
|
283
|
274
|
# Note that setting FIXED_RANGE may be necessary when running DevStack
|