blob: 9f5404926f86f24401cbd2bec28d52e190378dca [file] [log] [blame]
Dean Troyer7f9aa712012-01-31 12:11:56 -06001# functions - Common functions used by DevStack components
Dean Troyer13dc5cc2012-03-27 14:50:45 -05002#
Dean Troyer4a43b7b2012-08-28 17:43:40 -05003# The following variables are assumed to be defined by certain functions:
Dean Troyer4a43b7b2012-08-28 17:43:40 -05004# ``ENABLED_SERVICES``
5# ``EROR_ON_CLONE``
6# ``FILES``
7# ``GLANCE_HOSTPORT``
8# ``OFFLINE``
9# ``PIP_DOWNLOAD_CACHE``
Maru Newby3a87edd2012-10-25 23:01:06 +000010# ``PIP_USE_MIRRORS``
Dean Troyer4a43b7b2012-08-28 17:43:40 -050011# ``RECLONE``
12# ``TRACK_DEPENDS``
13# ``http_proxy``, ``https_proxy``, ``no_proxy``
Dean Troyer13dc5cc2012-03-27 14:50:45 -050014
Dean Troyer7f9aa712012-01-31 12:11:56 -060015
Dean Troyer27e32692012-03-16 16:16:56 -050016# Save trace setting
17XTRACE=$(set +o | grep xtrace)
18set +o xtrace
19
Dean Troyer7f9aa712012-01-31 12:11:56 -060020
Dean Troyer4a43b7b2012-08-28 17:43:40 -050021# Exit 0 if address is in network or 1 if address is not in
22# network or netaddr library is not installed.
23# address_in_net ip-address ip-range
Vishvananda Ishayac9ad14b2012-07-03 20:29:01 +000024function address_in_net() {
25 python -c "
26import netaddr
27import sys
28sys.exit(netaddr.IPAddress('$1') not in netaddr.IPNetwork('$2'))
29"
30}
31
32
Dean Troyer4a43b7b2012-08-28 17:43:40 -050033# Wrapper for ``apt-get`` to set cache and proxy environment variables
34# Uses globals ``OFFLINE``, ``*_proxy`
Dean Troyer13dc5cc2012-03-27 14:50:45 -050035# apt_get operation package [package ...]
Dean Troyer7f9aa712012-01-31 12:11:56 -060036function apt_get() {
Dean Troyerd0b21e22012-03-07 14:52:25 -060037 [[ "$OFFLINE" = "True" || -z "$@" ]] && return
Dean Troyer7f9aa712012-01-31 12:11:56 -060038 local sudo="sudo"
39 [[ "$(id -u)" = "0" ]] && sudo="env"
40 $sudo DEBIAN_FRONTEND=noninteractive \
41 http_proxy=$http_proxy https_proxy=$https_proxy \
Osamu Habuka7abe4f22012-07-25 12:39:32 +090042 no_proxy=$no_proxy \
Dean Troyer7f9aa712012-01-31 12:11:56 -060043 apt-get --option "Dpkg::Options::=--force-confold" --assume-yes "$@"
44}
45
46
47# Gracefully cp only if source file/dir exists
48# cp_it source destination
49function cp_it {
50 if [ -e $1 ] || [ -d $1 ]; then
51 cp -pRL $1 $2
52 fi
53}
54
55
Dean Troyer27e32692012-03-16 16:16:56 -050056# Prints "message" and exits
57# die "message"
58function die() {
Dean Troyer489bd2a2012-03-02 10:44:29 -060059 local exitcode=$?
Dean Troyer27e32692012-03-16 16:16:56 -050060 set +o xtrace
61 echo $@
62 exit $exitcode
Dean Troyer489bd2a2012-03-02 10:44:29 -060063}
64
65
66# Checks an environment variable is not set or has length 0 OR if the
67# exit code is non-zero and prints "message" and exits
68# NOTE: env-var is the variable name without a '$'
69# die_if_not_set env-var "message"
70function die_if_not_set() {
Dean Troyer27e32692012-03-16 16:16:56 -050071 (
72 local exitcode=$?
73 set +o xtrace
74 local evar=$1; shift
75 if ! is_set $evar || [ $exitcode != 0 ]; then
76 set +o xtrace
77 echo $@
78 exit -1
79 fi
80 )
Dean Troyer489bd2a2012-03-02 10:44:29 -060081}
82
83
84# Grab a numbered field from python prettytable output
85# Fields are numbered starting with 1
86# Reverse syntax is supported: -1 is the last field, -2 is second to last, etc.
87# get_field field-number
88function get_field() {
89 while read data; do
90 if [ "$1" -lt 0 ]; then
91 field="(\$(NF$1))"
92 else
93 field="\$$(($1 + 1))"
94 fi
95 echo "$data" | awk -F'[ \t]*\\|[ \t]*' "{print $field}"
96 done
97}
98
99
Dean Troyer7e270512012-06-14 15:23:24 -0500100# get_packages() collects a list of package names of any type from the
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500101# prerequisite files in ``files/{apts|rpms}``. The list is intended
102# to be passed to a package installer such as apt or yum.
Dean Troyer7e270512012-06-14 15:23:24 -0500103#
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500104# Only packages required for the services in ``ENABLED_SERVICES`` will be
Dean Troyer7e270512012-06-14 15:23:24 -0500105# included. Two bits of metadata are recognized in the prerequisite files:
106# - ``# NOPRIME`` defers installation to be performed later in stack.sh
107# - ``# dist:DISTRO`` or ``dist:DISTRO1,DISTRO2`` limits the selection
108# of the package to the distros listed. The distro names are case insensitive.
109#
Vincent Untz855c5872012-10-04 13:36:46 +0200110# Uses globals ``ENABLED_SERVICES``
Dean Troyer7e270512012-06-14 15:23:24 -0500111# get_packages dir
112function get_packages() {
113 local package_dir=$1
114 local file_to_parse
115 local service
116
117 if [[ -z "$package_dir" ]]; then
118 echo "No package directory supplied"
119 return 1
120 fi
121 if [[ -z "$DISTRO" ]]; then
Vincent Untz855c5872012-10-04 13:36:46 +0200122 GetDistro
Dean Troyer7e270512012-06-14 15:23:24 -0500123 fi
124 for service in general ${ENABLED_SERVICES//,/ }; do
125 # Allow individual services to specify dependencies
126 if [[ -e ${package_dir}/${service} ]]; then
127 file_to_parse="${file_to_parse} $service"
128 fi
129 # NOTE(sdague) n-api needs glance for now because that's where
130 # glance client is
131 if [[ $service == n-api ]]; then
132 if [[ ! $file_to_parse =~ nova ]]; then
133 file_to_parse="${file_to_parse} nova"
134 fi
135 if [[ ! $file_to_parse =~ glance ]]; then
136 file_to_parse="${file_to_parse} glance"
137 fi
138 elif [[ $service == c-* ]]; then
139 if [[ ! $file_to_parse =~ cinder ]]; then
140 file_to_parse="${file_to_parse} cinder"
141 fi
John H. Tran93361642012-07-26 11:22:05 -0700142 elif [[ $service == ceilometer-* ]]; then
143 if [[ ! $file_to_parse =~ ceilometer ]]; then
144 file_to_parse="${file_to_parse} ceilometer"
145 fi
Dean Troyer7e270512012-06-14 15:23:24 -0500146 elif [[ $service == n-* ]]; then
147 if [[ ! $file_to_parse =~ nova ]]; then
148 file_to_parse="${file_to_parse} nova"
149 fi
150 elif [[ $service == g-* ]]; then
151 if [[ ! $file_to_parse =~ glance ]]; then
152 file_to_parse="${file_to_parse} glance"
153 fi
154 elif [[ $service == key* ]]; then
155 if [[ ! $file_to_parse =~ keystone ]]; then
156 file_to_parse="${file_to_parse} keystone"
157 fi
Robert Collins0a9954f2012-11-20 11:34:25 +1300158 elif [[ $service == q-* ]]; then
159 if [[ ! $file_to_parse =~ quantum ]]; then
160 file_to_parse="${file_to_parse} quantum"
161 fi
Dean Troyer7e270512012-06-14 15:23:24 -0500162 fi
163 done
164
165 for file in ${file_to_parse}; do
166 local fname=${package_dir}/${file}
167 local OIFS line package distros distro
168 [[ -e $fname ]] || continue
169
170 OIFS=$IFS
171 IFS=$'\n'
172 for line in $(<${fname}); do
173 if [[ $line =~ "NOPRIME" ]]; then
174 continue
175 fi
176
177 if [[ $line =~ (.*)#.*dist:([^ ]*) ]]; then
178 # We are using BASH regexp matching feature.
179 package=${BASH_REMATCH[1]}
180 distros=${BASH_REMATCH[2]}
181 # In bash ${VAR,,} will lowecase VAR
182 [[ ${distros,,} =~ ${DISTRO,,} ]] && echo $package
183 continue
184 fi
185
186 echo ${line%#*}
187 done
188 IFS=$OIFS
189 done
190}
191
192
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500193# Determine OS Vendor, Release and Update
194# Tested with OS/X, Ubuntu, RedHat, CentOS, Fedora
195# Returns results in global variables:
196# os_VENDOR - vendor name
197# os_RELEASE - release
198# os_UPDATE - update
199# os_PACKAGE - package type
200# os_CODENAME - vendor's codename for release
201# GetOSVersion
202GetOSVersion() {
203 # Figure out which vendor we are
204 if [[ -n "`which sw_vers 2>/dev/null`" ]]; then
205 # OS/X
206 os_VENDOR=`sw_vers -productName`
207 os_RELEASE=`sw_vers -productVersion`
208 os_UPDATE=${os_RELEASE##*.}
209 os_RELEASE=${os_RELEASE%.*}
210 os_PACKAGE=""
211 if [[ "$os_RELEASE" =~ "10.7" ]]; then
212 os_CODENAME="lion"
213 elif [[ "$os_RELEASE" =~ "10.6" ]]; then
214 os_CODENAME="snow leopard"
215 elif [[ "$os_RELEASE" =~ "10.5" ]]; then
216 os_CODENAME="leopard"
217 elif [[ "$os_RELEASE" =~ "10.4" ]]; then
218 os_CODENAME="tiger"
219 elif [[ "$os_RELEASE" =~ "10.3" ]]; then
220 os_CODENAME="panther"
221 else
222 os_CODENAME=""
223 fi
224 elif [[ -x $(which lsb_release 2>/dev/null) ]]; then
225 os_VENDOR=$(lsb_release -i -s)
226 os_RELEASE=$(lsb_release -r -s)
227 os_UPDATE=""
228 if [[ "Debian,Ubuntu" =~ $os_VENDOR ]]; then
229 os_PACKAGE="deb"
230 else
231 os_PACKAGE="rpm"
232 fi
233 os_CODENAME=$(lsb_release -c -s)
234 elif [[ -r /etc/redhat-release ]]; then
235 # Red Hat Enterprise Linux Server release 5.5 (Tikanga)
236 # CentOS release 5.5 (Final)
237 # CentOS Linux release 6.0 (Final)
238 # Fedora release 16 (Verne)
239 os_CODENAME=""
240 for r in "Red Hat" CentOS Fedora; do
241 os_VENDOR=$r
242 if [[ -n "`grep \"$r\" /etc/redhat-release`" ]]; then
243 ver=`sed -e 's/^.* \(.*\) (\(.*\)).*$/\1\|\2/' /etc/redhat-release`
244 os_CODENAME=${ver#*|}
245 os_RELEASE=${ver%|*}
246 os_UPDATE=${os_RELEASE##*.}
247 os_RELEASE=${os_RELEASE%.*}
248 break
249 fi
250 os_VENDOR=""
251 done
252 os_PACKAGE="rpm"
253 fi
254 export os_VENDOR os_RELEASE os_UPDATE os_PACKAGE os_CODENAME
255}
256
Evgeniy Afonichev6a3912d2012-07-10 14:02:43 +0300257# git update using reference as a branch.
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500258# git_update_branch ref
Evgeniy Afonichev6a3912d2012-07-10 14:02:43 +0300259function git_update_branch() {
260
261 GIT_BRANCH=$1
262
263 git checkout -f origin/$GIT_BRANCH
264 # a local branch might not exist
265 git branch -D $GIT_BRANCH || true
266 git checkout -b $GIT_BRANCH
267}
268
269
270# git update using reference as a tag. Be careful editing source at that repo
271# as working copy will be in a detached mode
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500272# git_update_tag ref
Evgeniy Afonichev6a3912d2012-07-10 14:02:43 +0300273function git_update_tag() {
274
275 GIT_TAG=$1
276
277 git tag -d $GIT_TAG
278 # fetching given tag only
279 git fetch origin tag $GIT_TAG
280 git checkout -f $GIT_TAG
281}
282
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500283
Andrew Laskif900bd72012-09-05 17:23:14 -0400284# git update using reference as a branch.
285# git_update_remote_branch ref
286function git_update_remote_branch() {
287
288 GIT_BRANCH=$1
289
290 git checkout -b $GIT_BRANCH -t origin/$GIT_BRANCH
291}
292
293
Dean Troyera9e0a482012-07-09 14:07:23 -0500294# Translate the OS version values into common nomenclature
295# Sets ``DISTRO`` from the ``os_*`` values
296function GetDistro() {
297 GetOSVersion
298 if [[ "$os_VENDOR" =~ (Ubuntu) ]]; then
299 # 'Everyone' refers to Ubuntu releases by the code name adjective
300 DISTRO=$os_CODENAME
301 elif [[ "$os_VENDOR" =~ (Fedora) ]]; then
302 # For Fedora, just use 'f' and the release
303 DISTRO="f$os_RELEASE"
304 else
305 # Catch-all for now is Vendor + Release + Update
306 DISTRO="$os_VENDOR-$os_RELEASE.$os_UPDATE"
307 fi
308 export DISTRO
309}
310
311
Dean Troyer7f9aa712012-01-31 12:11:56 -0600312# git clone only if directory doesn't exist already. Since ``DEST`` might not
313# be owned by the installation user, we create the directory and change the
314# ownership to the proper user.
315# Set global RECLONE=yes to simulate a clone when dest-dir exists
James E. Blair94cb9602012-06-22 15:28:29 -0700316# Set global ERROR_ON_CLONE=True to abort execution with an error if the git repo
317# does not exist (default is False, meaning the repo will be cloned).
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500318# Uses global ``OFFLINE``
Dean Troyer7f9aa712012-01-31 12:11:56 -0600319# git_clone remote dest-dir branch
320function git_clone {
321 [[ "$OFFLINE" = "True" ]] && return
322
323 GIT_REMOTE=$1
324 GIT_DEST=$2
Evgeniy Afonichev6a3912d2012-07-10 14:02:43 +0300325 GIT_REF=$3
Dean Troyer7f9aa712012-01-31 12:11:56 -0600326
Evgeniy Afonichev6a3912d2012-07-10 14:02:43 +0300327 if echo $GIT_REF | egrep -q "^refs"; then
Dean Troyer7f9aa712012-01-31 12:11:56 -0600328 # If our branch name is a gerrit style refs/changes/...
329 if [[ ! -d $GIT_DEST ]]; then
James E. Blair94cb9602012-06-22 15:28:29 -0700330 [[ "$ERROR_ON_CLONE" = "True" ]] && exit 1
Dean Troyer7f9aa712012-01-31 12:11:56 -0600331 git clone $GIT_REMOTE $GIT_DEST
332 fi
333 cd $GIT_DEST
Evgeniy Afonichev6a3912d2012-07-10 14:02:43 +0300334 git fetch $GIT_REMOTE $GIT_REF && git checkout FETCH_HEAD
Dean Troyer7f9aa712012-01-31 12:11:56 -0600335 else
336 # do a full clone only if the directory doesn't exist
337 if [[ ! -d $GIT_DEST ]]; then
James E. Blair94cb9602012-06-22 15:28:29 -0700338 [[ "$ERROR_ON_CLONE" = "True" ]] && exit 1
Dean Troyer7f9aa712012-01-31 12:11:56 -0600339 git clone $GIT_REMOTE $GIT_DEST
340 cd $GIT_DEST
341 # This checkout syntax works for both branches and tags
Evgeniy Afonichev6a3912d2012-07-10 14:02:43 +0300342 git checkout $GIT_REF
Dean Troyer7f9aa712012-01-31 12:11:56 -0600343 elif [[ "$RECLONE" == "yes" ]]; then
344 # if it does exist then simulate what clone does if asked to RECLONE
345 cd $GIT_DEST
346 # set the url to pull from and fetch
347 git remote set-url origin $GIT_REMOTE
348 git fetch origin
349 # remove the existing ignored files (like pyc) as they cause breakage
350 # (due to the py files having older timestamps than our pyc, so python
351 # thinks the pyc files are correct using them)
352 find $GIT_DEST -name '*.pyc' -delete
Evgeniy Afonichev6a3912d2012-07-10 14:02:43 +0300353
354 # handle GIT_REF accordingly to type (tag, branch)
355 if [[ -n "`git show-ref refs/tags/$GIT_REF`" ]]; then
356 git_update_tag $GIT_REF
357 elif [[ -n "`git show-ref refs/heads/$GIT_REF`" ]]; then
358 git_update_branch $GIT_REF
Andrew Laskif900bd72012-09-05 17:23:14 -0400359 elif [[ -n "`git show-ref refs/remotes/origin/$GIT_REF`" ]]; then
360 git_update_remote_branch $GIT_REF
Evgeniy Afonichev6a3912d2012-07-10 14:02:43 +0300361 else
362 echo $GIT_REF is neither branch nor tag
363 exit 1
364 fi
365
Dean Troyer7f9aa712012-01-31 12:11:56 -0600366 fi
367 fi
368}
369
370
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500371# Comment an option in an INI file
Chmouel Boudjnahc7214e82012-06-06 13:56:39 +0200372# inicomment config-file section option
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500373function inicomment() {
374 local file=$1
375 local section=$2
376 local option=$3
377 sed -i -e "/^\[$section\]/,/^\[.*\]/ s|^\($option[ \t]*=.*$\)|#\1|" $file
378}
379
Chmouel Boudjnahc7214e82012-06-06 13:56:39 +0200380# Uncomment an option in an INI file
381# iniuncomment config-file section option
382function iniuncomment() {
383 local file=$1
384 local section=$2
385 local option=$3
386 sed -i -e "/^\[$section\]/,/^\[.*\]/ s|[^ \t]*#[ \t]*\($option[ \t]*=.*$\)|\1|" $file
387}
388
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500389
390# Get an option from an INI file
Dean Troyer09e636e2012-03-19 16:31:12 -0500391# iniget config-file section option
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500392function iniget() {
393 local file=$1
394 local section=$2
395 local option=$3
396 local line
397 line=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" $file)
398 echo ${line#*=}
399}
400
401
402# Set an option in an INI file
Dean Troyer09e636e2012-03-19 16:31:12 -0500403# iniset config-file section option value
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500404function iniset() {
405 local file=$1
406 local section=$2
407 local option=$3
408 local value=$4
Dean Troyer09e636e2012-03-19 16:31:12 -0500409 if ! grep -q "^\[$section\]" $file; then
410 # Add section at the end
411 echo -e "\n[$section]" >>$file
412 fi
413 if [[ -z "$(iniget $file $section $option)" ]]; then
414 # Add it
415 sed -i -e "/^\[$section\]/ a\\
416$option = $value
417" $file
418 else
419 # Replace it
420 sed -i -e "/^\[$section\]/,/^\[.*\]/ s|^\($option[ \t]*=[ \t]*\).*$|\1$value|" $file
421 fi
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500422}
423
424
Chmouel Boudjnah408b0092012-03-15 23:21:55 +0000425# is_service_enabled() checks if the service(s) specified as arguments are
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500426# enabled by the user in ``ENABLED_SERVICES``.
Chmouel Boudjnah408b0092012-03-15 23:21:55 +0000427#
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500428# Multiple services specified as arguments are ``OR``'ed together; the test
429# is a short-circuit boolean, i.e it returns on the first match.
Chmouel Boudjnah408b0092012-03-15 23:21:55 +0000430#
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500431# There are special cases for some 'catch-all' services::
Chmouel Boudjnah408b0092012-03-15 23:21:55 +0000432# **nova** returns true if any service enabled start with **n-**
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500433# **cinder** returns true if any service enabled start with **c-**
434# **ceilometer** returns true if any service enabled start with **ceilometer**
Chmouel Boudjnah408b0092012-03-15 23:21:55 +0000435# **glance** returns true if any service enabled start with **g-**
436# **quantum** returns true if any service enabled start with **q-**
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500437#
438# Uses global ``ENABLED_SERVICES``
439# is_service_enabled service [service ...]
Chmouel Boudjnah408b0092012-03-15 23:21:55 +0000440function is_service_enabled() {
441 services=$@
442 for service in ${services}; do
443 [[ ,${ENABLED_SERVICES}, =~ ,${service}, ]] && return 0
444 [[ ${service} == "nova" && ${ENABLED_SERVICES} =~ "n-" ]] && return 0
Dean Troyer67787e62012-05-02 11:48:15 -0500445 [[ ${service} == "cinder" && ${ENABLED_SERVICES} =~ "c-" ]] && return 0
John H. Tran93361642012-07-26 11:22:05 -0700446 [[ ${service} == "ceilometer" && ${ENABLED_SERVICES} =~ "ceilometer-" ]] && return 0
Chmouel Boudjnah408b0092012-03-15 23:21:55 +0000447 [[ ${service} == "glance" && ${ENABLED_SERVICES} =~ "g-" ]] && return 0
448 [[ ${service} == "quantum" && ${ENABLED_SERVICES} =~ "q-" ]] && return 0
449 done
450 return 1
451}
452
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500453
454# remove extra commas from the input string (i.e. ``ENABLED_SERVICES``)
455# _cleanup_service_list service-list
Doug Hellmannf04178f2012-07-05 17:10:03 -0400456function _cleanup_service_list () {
Dean Troyerca0e3d02012-04-13 15:58:37 -0500457 echo "$1" | sed -e '
Doug Hellmannf04178f2012-07-05 17:10:03 -0400458 s/,,/,/g;
459 s/^,//;
460 s/,$//
461 '
462}
463
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500464
Doug Hellmannf04178f2012-07-05 17:10:03 -0400465# enable_service() adds the services passed as argument to the
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500466# ``ENABLED_SERVICES`` list, if they are not already present.
Doug Hellmannf04178f2012-07-05 17:10:03 -0400467#
468# For example:
Joe Gordon6fd28112012-11-13 16:55:41 -0800469# enable_service qpid
Doug Hellmannf04178f2012-07-05 17:10:03 -0400470#
471# This function does not know about the special cases
472# for nova, glance, and quantum built into is_service_enabled().
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500473# Uses global ``ENABLED_SERVICES``
474# enable_service service [service ...]
Doug Hellmannf04178f2012-07-05 17:10:03 -0400475function enable_service() {
476 local tmpsvcs="${ENABLED_SERVICES}"
477 for service in $@; do
478 if ! is_service_enabled $service; then
479 tmpsvcs+=",$service"
480 fi
481 done
482 ENABLED_SERVICES=$(_cleanup_service_list "$tmpsvcs")
483 disable_negated_services
484}
485
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500486
Doug Hellmannf04178f2012-07-05 17:10:03 -0400487# disable_service() removes the services passed as argument to the
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500488# ``ENABLED_SERVICES`` list, if they are present.
Doug Hellmannf04178f2012-07-05 17:10:03 -0400489#
490# For example:
Joe Gordon6fd28112012-11-13 16:55:41 -0800491# disable_service rabbit
Doug Hellmannf04178f2012-07-05 17:10:03 -0400492#
493# This function does not know about the special cases
494# for nova, glance, and quantum built into is_service_enabled().
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500495# Uses global ``ENABLED_SERVICES``
496# disable_service service [service ...]
Doug Hellmannf04178f2012-07-05 17:10:03 -0400497function disable_service() {
498 local tmpsvcs=",${ENABLED_SERVICES},"
499 local service
500 for service in $@; do
501 if is_service_enabled $service; then
502 tmpsvcs=${tmpsvcs//,$service,/,}
503 fi
504 done
505 ENABLED_SERVICES=$(_cleanup_service_list "$tmpsvcs")
506}
507
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500508
Doug Hellmannf04178f2012-07-05 17:10:03 -0400509# disable_all_services() removes all current services
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500510# from ``ENABLED_SERVICES`` to reset the configuration
Doug Hellmannf04178f2012-07-05 17:10:03 -0400511# before a minimal installation
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500512# Uses global ``ENABLED_SERVICES``
513# disable_all_services
Doug Hellmannf04178f2012-07-05 17:10:03 -0400514function disable_all_services() {
515 ENABLED_SERVICES=""
516}
517
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500518
519# Remove all services starting with '-'. For example, to install all default
Joe Gordon6fd28112012-11-13 16:55:41 -0800520# services except rabbit (rabbit) set in ``localrc``:
521# ENABLED_SERVICES+=",-rabbit"
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500522# Uses global ``ENABLED_SERVICES``
523# disable_negated_services
Doug Hellmannf04178f2012-07-05 17:10:03 -0400524function disable_negated_services() {
525 local tmpsvcs="${ENABLED_SERVICES}"
526 local service
527 for service in ${tmpsvcs//,/ }; do
528 if [[ ${service} == -* ]]; then
529 tmpsvcs=$(echo ${tmpsvcs}|sed -r "s/(,)?(-)?${service#-}(,)?/,/g")
530 fi
531 done
532 ENABLED_SERVICES=$(_cleanup_service_list "$tmpsvcs")
533}
Dean Troyer489bd2a2012-03-02 10:44:29 -0600534
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500535
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500536# Distro-agnostic package installer
537# install_package package [package ...]
538function install_package() {
539 if [[ -z "$os_PACKAGE" ]]; then
540 GetOSVersion
541 fi
Vincent Untzc0482e62012-06-12 11:30:43 +0200542
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500543 if [[ "$os_PACKAGE" = "deb" ]]; then
Vincent Untzc0482e62012-06-12 11:30:43 +0200544 [[ "$NO_UPDATE_REPOS" = "True" ]] || apt_get update
545 NO_UPDATE_REPOS=True
546
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500547 apt_get install "$@"
548 else
549 yum_install "$@"
550 fi
551}
552
553
Vincent Untz71ebc6f2012-06-12 13:45:15 +0200554# Distro-agnostic function to tell if a package is installed
555# is_package_installed package [package ...]
556function is_package_installed() {
557 if [[ -z "$@" ]]; then
558 return 1
559 fi
560
561 if [[ -z "$os_PACKAGE" ]]; then
562 GetOSVersion
563 fi
564 if [[ "$os_PACKAGE" = "deb" ]]; then
565 dpkg -l "$@" > /dev/null
566 return $?
567 else
568 rpm --quiet -q "$@"
569 return $?
570 fi
571}
572
573
Dean Troyer489bd2a2012-03-02 10:44:29 -0600574# Test if the named environment variable is set and not zero length
575# is_set env-var
576function is_set() {
577 local var=\$"$1"
Dean Troyere88c0a22012-11-02 16:59:03 -0500578 if eval "[ -z \"$var\" ]"; then
Dean Troyer489bd2a2012-03-02 10:44:29 -0600579 return 1
580 fi
581 return 0
582}
583
584
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500585# Wrapper for ``pip install`` to set cache and proxy environment variables
Maru Newby3a87edd2012-10-25 23:01:06 +0000586# Uses globals ``OFFLINE``, ``PIP_DOWNLOAD_CACHE``, ``PIP_USE_MIRRORS``,
587# ``TRACK_DEPENDS``, ``*_proxy`
Dean Troyer7f9aa712012-01-31 12:11:56 -0600588# pip_install package [package ...]
589function pip_install {
Dean Troyerd0b21e22012-03-07 14:52:25 -0600590 [[ "$OFFLINE" = "True" || -z "$@" ]] && return
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500591 if [[ -z "$os_PACKAGE" ]]; then
592 GetOSVersion
593 fi
Monty Taylor47f02062012-07-26 11:09:24 -0500594 if [[ $TRACK_DEPENDS = True ]] ; then
595 source $DEST/.venv/bin/activate
596 CMD_PIP=$DEST/.venv/bin/pip
597 SUDO_PIP="env"
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500598 else
Monty Taylor47f02062012-07-26 11:09:24 -0500599 SUDO_PIP="sudo"
600 if [[ "$os_PACKAGE" = "deb" ]]; then
601 CMD_PIP=/usr/bin/pip
602 else
603 CMD_PIP=/usr/bin/pip-python
604 fi
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500605 fi
Maru Newby3a87edd2012-10-25 23:01:06 +0000606 if [[ "$PIP_USE_MIRRORS" != "False" ]]; then
607 PIP_MIRROR_OPT="--use-mirrors"
608 fi
Monty Taylor47f02062012-07-26 11:09:24 -0500609 $SUDO_PIP PIP_DOWNLOAD_CACHE=${PIP_DOWNLOAD_CACHE:-/var/cache/pip} \
Dean Troyer7f9aa712012-01-31 12:11:56 -0600610 HTTP_PROXY=$http_proxy \
611 HTTPS_PROXY=$https_proxy \
Osamu Habuka7abe4f22012-07-25 12:39:32 +0900612 NO_PROXY=$no_proxy \
Maru Newby3a87edd2012-10-25 23:01:06 +0000613 $CMD_PIP install $PIP_MIRROR_OPT $@
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500614}
615
616
617# Service wrapper to restart services
618# restart_service service-name
619function restart_service() {
Dean Troyer5218d452012-02-04 02:13:23 -0600620 if [[ -z "$os_PACKAGE" ]]; then
621 GetOSVersion
622 fi
623 if [[ "$os_PACKAGE" = "deb" ]]; then
624 sudo /usr/sbin/service $1 restart
625 else
626 sudo /sbin/service $1 restart
627 fi
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500628}
629
630
Dean Troyer15733352012-09-06 11:51:30 -0500631# Helper to launch a service in a named screen
632# screen_it service "command-line"
633function screen_it {
634 NL=`echo -ne '\015'`
635 SCREEN_NAME=${SCREEN_NAME:-stack}
636 if is_service_enabled $1; then
637 # Append the service to the screen rc file
638 screen_rc "$1" "$2"
639
640 screen -S $SCREEN_NAME -X screen -t $1
641 # sleep to allow bash to be ready to be send the command - we are
642 # creating a new window in screen and then sends characters, so if
643 # bash isn't running by the time we send the command, nothing happens
644 sleep 1.5
645
646 if [[ -n ${SCREEN_LOGDIR} ]]; then
647 screen -S $SCREEN_NAME -p $1 -X logfile ${SCREEN_LOGDIR}/screen-${1}.${CURRENT_LOG_TIME}.log
648 screen -S $SCREEN_NAME -p $1 -X log on
649 ln -sf ${SCREEN_LOGDIR}/screen-${1}.${CURRENT_LOG_TIME}.log ${SCREEN_LOGDIR}/screen-${1}.log
650 fi
651 screen -S $SCREEN_NAME -p $1 -X stuff "$2$NL"
652 fi
653}
654
655
656# Screen rc file builder
657# screen_rc service "command-line"
658function screen_rc {
659 SCREEN_NAME=${SCREEN_NAME:-stack}
660 SCREENRC=$TOP_DIR/$SCREEN_NAME-screenrc
661 if [[ ! -e $SCREENRC ]]; then
662 # Name the screen session
663 echo "sessionname $SCREEN_NAME" > $SCREENRC
664 # Set a reasonable statusbar
665 echo "hardstatus alwayslastline '$SCREEN_HARDSTATUS'" >> $SCREENRC
666 echo "screen -t shell bash" >> $SCREENRC
667 fi
668 # If this service doesn't already exist in the screenrc file
669 if ! grep $1 $SCREENRC 2>&1 > /dev/null; then
670 NL=`echo -ne '\015'`
671 echo "screen -t $1 bash" >> $SCREENRC
672 echo "stuff \"$2$NL\"" >> $SCREENRC
673 fi
674}
675
676
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500677# ``pip install`` the dependencies of the package before ``setup.py develop``
678# so pip and not distutils processes the dependency chain
679# Uses globals ``TRACK_DEPENDES``, ``*_proxy`
Dean Troyerbbafb1b2012-06-11 16:51:39 -0500680# setup_develop directory
681function setup_develop() {
Monty Taylor47f02062012-07-26 11:09:24 -0500682 if [[ $TRACK_DEPENDS = True ]] ; then
683 SUDO_CMD="env"
684 else
685 SUDO_CMD="sudo"
686 fi
Dean Troyerbbafb1b2012-06-11 16:51:39 -0500687 (cd $1; \
688 python setup.py egg_info; \
689 raw_links=$(awk '/^.+/ {print "-f " $1}' *.egg-info/dependency_links.txt); \
690 depend_links=$(echo $raw_links | xargs); \
Dean Troyer1a3c9fe2012-09-29 17:25:02 -0500691 require_file=$([ ! -r *-info/requires.txt ] || echo "-r *-info/requires.txt"); \
692 pip_install $require_file $depend_links; \
Monty Taylor47f02062012-07-26 11:09:24 -0500693 $SUDO_CMD \
Dean Troyerbbafb1b2012-06-11 16:51:39 -0500694 HTTP_PROXY=$http_proxy \
695 HTTPS_PROXY=$https_proxy \
Osamu Habuka7abe4f22012-07-25 12:39:32 +0900696 NO_PROXY=$no_proxy \
Dean Troyerbbafb1b2012-06-11 16:51:39 -0500697 python setup.py develop \
698 )
699}
700
701
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500702# Service wrapper to start services
703# start_service service-name
704function start_service() {
Dean Troyer5218d452012-02-04 02:13:23 -0600705 if [[ -z "$os_PACKAGE" ]]; then
706 GetOSVersion
707 fi
708 if [[ "$os_PACKAGE" = "deb" ]]; then
709 sudo /usr/sbin/service $1 start
710 else
711 sudo /sbin/service $1 start
712 fi
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500713}
714
715
716# Service wrapper to stop services
717# stop_service service-name
718function stop_service() {
Dean Troyer5218d452012-02-04 02:13:23 -0600719 if [[ -z "$os_PACKAGE" ]]; then
720 GetOSVersion
721 fi
722 if [[ "$os_PACKAGE" = "deb" ]]; then
723 sudo /usr/sbin/service $1 stop
724 else
725 sudo /sbin/service $1 stop
726 fi
Dean Troyer7f9aa712012-01-31 12:11:56 -0600727}
728
729
730# Normalize config values to True or False
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500731# Accepts as False: 0 no false False FALSE
732# Accepts as True: 1 yes true True TRUE
733# VAR=$(trueorfalse default-value test-value)
Dean Troyer7f9aa712012-01-31 12:11:56 -0600734function trueorfalse() {
735 local default=$1
736 local testval=$2
737
738 [[ -z "$testval" ]] && { echo "$default"; return; }
739 [[ "0 no false False FALSE" =~ "$testval" ]] && { echo "False"; return; }
740 [[ "1 yes true True TRUE" =~ "$testval" ]] && { echo "True"; return; }
741 echo "$default"
742}
Dean Troyer27e32692012-03-16 16:16:56 -0500743
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500744
Dean Troyerca0e3d02012-04-13 15:58:37 -0500745# Retrieve an image from a URL and upload into Glance
746# Uses the following variables:
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500747# ``FILES`` must be set to the cache dir
748# ``GLANCE_HOSTPORT``
Dean Troyerca0e3d02012-04-13 15:58:37 -0500749# upload_image image-url glance-token
750function upload_image() {
751 local image_url=$1
752 local token=$2
753
754 # Create a directory for the downloaded image tarballs.
755 mkdir -p $FILES/images
756
757 # Downloads the image (uec ami+aki style), then extracts it.
758 IMAGE_FNAME=`basename "$image_url"`
759 if [[ ! -f $FILES/$IMAGE_FNAME || "$(stat -c "%s" $FILES/$IMAGE_FNAME)" = "0" ]]; then
760 wget -c $image_url -O $FILES/$IMAGE_FNAME
761 if [[ $? -ne 0 ]]; then
762 echo "Not found: $image_url"
763 return
764 fi
765 fi
766
767 # OpenVZ-format images are provided as .tar.gz, but not decompressed prior to loading
768 if [[ "$image_url" =~ 'openvz' ]]; then
769 IMAGE="$FILES/${IMAGE_FNAME}"
770 IMAGE_NAME="${IMAGE_FNAME%.tar.gz}"
771 glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" --is-public=True --container-format ami --disk-format ami < "${IMAGE}"
772 return
773 fi
774
775 KERNEL=""
776 RAMDISK=""
777 DISK_FORMAT=""
778 CONTAINER_FORMAT=""
779 UNPACK=""
780 case "$IMAGE_FNAME" in
781 *.tar.gz|*.tgz)
782 # Extract ami and aki files
783 [ "${IMAGE_FNAME%.tar.gz}" != "$IMAGE_FNAME" ] &&
784 IMAGE_NAME="${IMAGE_FNAME%.tar.gz}" ||
785 IMAGE_NAME="${IMAGE_FNAME%.tgz}"
786 xdir="$FILES/images/$IMAGE_NAME"
787 rm -Rf "$xdir";
788 mkdir "$xdir"
789 tar -zxf $FILES/$IMAGE_FNAME -C "$xdir"
790 KERNEL=$(for f in "$xdir/"*-vmlinuz* "$xdir/"aki-*/image; do
791 [ -f "$f" ] && echo "$f" && break; done; true)
792 RAMDISK=$(for f in "$xdir/"*-initrd* "$xdir/"ari-*/image; do
793 [ -f "$f" ] && echo "$f" && break; done; true)
794 IMAGE=$(for f in "$xdir/"*.img "$xdir/"ami-*/image; do
795 [ -f "$f" ] && echo "$f" && break; done; true)
796 if [[ -z "$IMAGE_NAME" ]]; then
797 IMAGE_NAME=$(basename "$IMAGE" ".img")
798 fi
799 ;;
800 *.img)
801 IMAGE="$FILES/$IMAGE_FNAME";
802 IMAGE_NAME=$(basename "$IMAGE" ".img")
Dean Troyer636a3ff2012-09-14 11:36:07 -0500803 format=$(qemu-img info ${IMAGE} | awk '/^file format/ { print $3; exit }')
804 if [[ ",qcow2,raw,vdi,vmdk,vpc," =~ ",$format," ]]; then
805 DISK_FORMAT=$format
806 else
807 DISK_FORMAT=raw
808 fi
Dean Troyerca0e3d02012-04-13 15:58:37 -0500809 CONTAINER_FORMAT=bare
810 ;;
811 *.img.gz)
812 IMAGE="$FILES/${IMAGE_FNAME}"
813 IMAGE_NAME=$(basename "$IMAGE" ".img.gz")
814 DISK_FORMAT=raw
815 CONTAINER_FORMAT=bare
816 UNPACK=zcat
817 ;;
818 *.qcow2)
819 IMAGE="$FILES/${IMAGE_FNAME}"
820 IMAGE_NAME=$(basename "$IMAGE" ".qcow2")
821 DISK_FORMAT=qcow2
822 CONTAINER_FORMAT=bare
823 ;;
824 *) echo "Do not know what to do with $IMAGE_FNAME"; false;;
825 esac
826
827 if [ "$CONTAINER_FORMAT" = "bare" ]; then
828 if [ "$UNPACK" = "zcat" ]; then
829 glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" --public --container-format=$CONTAINER_FORMAT --disk-format $DISK_FORMAT < <(zcat --force "${IMAGE}")
830 else
831 glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" --public --container-format=$CONTAINER_FORMAT --disk-format $DISK_FORMAT < "${IMAGE}"
832 fi
833 else
834 # Use glance client to add the kernel the root filesystem.
835 # We parse the results of the first upload to get the glance ID of the
836 # kernel for use when uploading the root filesystem.
837 KERNEL_ID=""; RAMDISK_ID="";
838 if [ -n "$KERNEL" ]; then
839 KERNEL_ID=$(glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME-kernel" --public --container-format aki --disk-format aki < "$KERNEL" | grep ' id ' | get_field 2)
840 fi
841 if [ -n "$RAMDISK" ]; then
842 RAMDISK_ID=$(glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME-ramdisk" --public --container-format ari --disk-format ari < "$RAMDISK" | grep ' id ' | get_field 2)
843 fi
844 glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "${IMAGE_NAME%.img}" --public --container-format ami --disk-format ami ${KERNEL_ID:+--property kernel_id=$KERNEL_ID} ${RAMDISK_ID:+--property ramdisk_id=$RAMDISK_ID} < "${IMAGE}"
845 fi
846}
847
Dean Troyerc1b486a2012-11-05 14:26:09 -0600848# Set the database backend to use
849# When called from stackrc/localrc DATABASE_BACKENDS has not been
850# initialized yet, just save the configuration selection and call back later
851# to validate it.
852# $1 The name of the database backend to use (mysql, postgresql, ...)
853function use_database {
854 if [[ -z "$DATABASE_BACKENDS" ]]; then
855 # The backends haven't initialized yet, just save the selection for now
856 DATABASE_TYPE=$1
857 return
858 fi
859 use_exclusive_service DATABASE_BACKENDS DATABASE_TYPE $1 && return 0
860 ret=$?
861 return $ret
862}
863
Terry Wilson428af5a2012-11-01 16:12:39 -0400864# Toggle enable/disable_service for services that must run exclusive of each other
865# $1 The name of a variable containing a space-separated list of services
866# $2 The name of a variable in which to store the enabled service's name
867# $3 The name of the service to enable
868function use_exclusive_service {
869 local options=${!1}
870 local selection=$3
871 out=$2
872 [ -z $selection ] || [[ ! "$options" =~ "$selection" ]] && return 1
873 for opt in $options;do
874 [[ "$opt" = "$selection" ]] && enable_service $opt || disable_service $opt
875 done
876 eval "$out=$selection"
877 return 0
878}
Dean Troyerca0e3d02012-04-13 15:58:37 -0500879
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500880# Wrapper for ``yum`` to set proxy environment variables
881# Uses globals ``OFFLINE``, ``*_proxy`
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500882# yum_install package [package ...]
883function yum_install() {
884 [[ "$OFFLINE" = "True" ]] && return
885 local sudo="sudo"
886 [[ "$(id -u)" = "0" ]] && sudo="env"
887 $sudo http_proxy=$http_proxy https_proxy=$https_proxy \
Osamu Habuka7abe4f22012-07-25 12:39:32 +0900888 no_proxy=$no_proxy \
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500889 yum install -y "$@"
890}
891
Nachi Uenofda946e2012-10-24 17:26:02 -0700892# ping check
893# Uses globals ``ENABLED_SERVICES``
894function ping_check() {
Nachi Ueno5db5bfa2012-10-29 11:25:29 -0700895 if is_service_enabled quantum; then
896 _ping_check_quantum "$1" $2 $3 $4
897 return
898 fi
899 _ping_check_novanet "$1" $2 $3 $4
Nachi Uenofda946e2012-10-24 17:26:02 -0700900}
901
902# ping check for nova
903# Uses globals ``MULTI_HOST``, ``PRIVATE_NETWORK``
904function _ping_check_novanet() {
905 local from_net=$1
906 local ip=$2
907 local boot_timeout=$3
Nachi Ueno5db5bfa2012-10-29 11:25:29 -0700908 local expected=${4:-"True"}
909 local check_command=""
Nachi Uenofda946e2012-10-24 17:26:02 -0700910 MULTI_HOST=`trueorfalse False $MULTI_HOST`
911 if [[ "$MULTI_HOST" = "True" && "$from_net" = "$PRIVATE_NETWORK_NAME" ]]; then
912 sleep $boot_timeout
913 return
914 fi
Nachi Ueno5db5bfa2012-10-29 11:25:29 -0700915 if [[ "$expected" = "True" ]]; then
916 check_command="while ! ping -c1 -w1 $ip; do sleep 1; done"
917 else
918 check_command="while ping -c1 -w1 $ip; do sleep 1; done"
919 fi
920 if ! timeout $boot_timeout sh -c "$check_command"; then
921 if [[ "$expected" = "True" ]]; then
922 echo "[Fail] Couldn't ping server"
923 else
924 echo "[Fail] Could ping server"
925 fi
Nachi Uenofda946e2012-10-24 17:26:02 -0700926 exit 1
927 fi
928}
929
930# ssh check
Nachi Ueno5db5bfa2012-10-29 11:25:29 -0700931
Nachi Uenofda946e2012-10-24 17:26:02 -0700932function ssh_check() {
Nachi Ueno5db5bfa2012-10-29 11:25:29 -0700933 if is_service_enabled quantum; then
934 _ssh_check_quantum "$1" $2 $3 $4 $5
935 return
936 fi
937 _ssh_check_novanet "$1" $2 $3 $4 $5
938}
939
940function _ssh_check_novanet() {
Nachi Uenofda946e2012-10-24 17:26:02 -0700941 local NET_NAME=$1
942 local KEY_FILE=$2
943 local FLOATING_IP=$3
944 local DEFAULT_INSTANCE_USER=$4
945 local ACTIVE_TIMEOUT=$5
Dean Troyer6931c132012-11-07 16:51:21 -0600946 local probe_cmd=""
Nachi Uenofda946e2012-10-24 17:26:02 -0700947 if ! timeout $ACTIVE_TIMEOUT sh -c "while ! ssh -o StrictHostKeyChecking=no -i $KEY_FILE ${DEFAULT_INSTANCE_USER}@$FLOATING_IP echo success ; do sleep 1; done"; then
948 echo "server didn't become ssh-able!"
949 exit 1
950 fi
951}
Dean Troyer13dc5cc2012-03-27 14:50:45 -0500952
Dean Troyer27e32692012-03-16 16:16:56 -0500953# Restore xtrace
Chmouel Boudjnah408b0092012-03-15 23:21:55 +0000954$XTRACE
Dean Troyer4a43b7b2012-08-28 17:43:40 -0500955
956
957# Local variables:
958# -*- mode: Shell-script -*-
Andrew Laskif900bd72012-09-05 17:23:14 -0400959# End: