Skip to content

Commit 8745286

Browse files
Merge remote-tracking branch 'origin/master'
2 parents 977b334 + 5334ca0 commit 8745286

File tree

3 files changed

+65
-7
lines changed

3 files changed

+65
-7
lines changed

files/000-default.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
DocumentRoot %HORIZON_DIR%/.blackhole/
99
Alias /media %HORIZON_DIR%/openstack-dashboard/media
10+
Alias /vpn /opt/stack/vpn
1011

1112
<Directory />
1213
Options FollowSymLinks

files/apts/nova

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnsmasq-base
2-
dnsmasq-utils # for dhcp_release
2+
dnsmasq-utils # for dhcp_release only available in dist:oneiric
33
kpartx
44
parted
55
arping # used for send_arp_for_ha option in nova-network

stack.sh

Lines changed: 63 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222

2323
# Warn users who aren't on natty, but allow them to override check and attempt
2424
# installation with ``FORCE=yes ./stack``
25-
if ! egrep -q 'natty|oneiric' /etc/lsb-release; then
25+
DISTRO=$(lsb_release -c -s)
26+
27+
if [[ ! ${DISTRO} =~ (natty|oneiric) ]]; then
2628
echo "WARNING: this script has only been tested on natty and oneiric"
2729
if [[ "$FORCE" != "yes" ]]; then
2830
echo "If you wish to run this script anyway run with FORCE=yes"
@@ -372,10 +374,65 @@ fi
372374
#
373375
# Openstack uses a fair number of other projects.
374376

377+
# - We are going to install packages only for the services needed.
378+
# - We are parsing the packages files and detecting metadatas.
379+
# - If there is a NOPRIME as comment mean we are not doing the install
380+
# just yet.
381+
# - If we have the meta-keyword distro:DISTRO or
382+
# distro:DISTRO1,DISTRO2 it will be installed only for those
383+
# distros (case insensitive).
384+
function get_packages() {
385+
local file_to_parse="general"
386+
local service
387+
388+
for service in ${ENABLED_SERVICES//,/ }; do
389+
if [[ $service == n-* ]]; then
390+
if [[ ! $file_to_parse =~ nova ]]; then
391+
file_to_parse="${file_to_parse} nova"
392+
fi
393+
elif [[ $service == g-* ]]; then
394+
if [[ ! $file_to_parse =~ glance ]]; then
395+
file_to_parse="${file_to_parse} glance"
396+
fi
397+
elif [[ $service == key* ]]; then
398+
if [[ ! $file_to_parse =~ keystone ]]; then
399+
file_to_parse="${file_to_parse} keystone"
400+
fi
401+
elif [[ -e $FILES/apts/${service} ]]; then
402+
file_to_parse="${file_to_parse} $service"
403+
fi
404+
done
405+
406+
for file in ${file_to_parse}; do
407+
local fname=${FILES}/apts/${file}
408+
local OIFS line package distros distro
409+
[[ -e $fname ]] || { echo "missing: $fname"; exit 1 ;}
410+
411+
OIFS=$IFS
412+
IFS=$'\n'
413+
for line in $(<${fname}); do
414+
if [[ $line =~ "NOPRIME" ]]; then
415+
continue
416+
fi
417+
418+
if [[ $line =~ (.*)#.*dist:([^ ]*) ]]; then # We are using BASH regexp matching feature.
419+
package=${BASH_REMATCH[1]}
420+
distros=${BASH_REMATCH[2]}
421+
for distro in ${distros//,/ }; do #In bash ${VAR,,} will lowecase VAR
422+
[[ ${distro,,} == ${DISTRO,,} ]] && echo $package
423+
done
424+
continue
425+
fi
426+
427+
echo ${line%#*}
428+
done
429+
IFS=$OIFS
430+
done
431+
}
375432

376433
# install apt requirements
377434
apt_get update
378-
apt_get install `cat $FILES/apts/* | cut -d\# -f1 | grep -Ev "mysql-server|rabbitmq-server|memcached"`
435+
apt_get install $(get_packages)
379436

380437
# install python requirements
381438
sudo PIP_DOWNLOAD_CACHE=/var/cache/pip pip install --use-mirrors `cat $FILES/pips/*`
@@ -689,7 +746,7 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
689746
sudo chown -R $USER:${USER_GROUP} ${SWIFT_DATA_LOCATION}/drives
690747

691748
# We then create a loopback disk and format it to XFS.
692-
if [[ ! -e ${SWIFT_DATA_LOCATION}/drives/images/swift.img ]];then
749+
if [[ ! -e ${SWIFT_DATA_LOCATION}/drives/images/swift.img ]]; then
693750
mkdir -p ${SWIFT_DATA_LOCATION}/drives/images
694751
sudo touch ${SWIFT_DATA_LOCATION}/drives/images/swift.img
695752
sudo chown $USER: ${SWIFT_DATA_LOCATION}/drives/images/swift.img
@@ -702,7 +759,7 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
702759
# After the drive being created we mount the disk with a few mount
703760
# options to make it most efficient as possible for swift.
704761
mkdir -p ${SWIFT_DATA_LOCATION}/drives/sdb1
705-
if ! egrep -q ${SWIFT_DATA_LOCATION}/drives/sdb1 /proc/mounts;then
762+
if ! egrep -q ${SWIFT_DATA_LOCATION}/drives/sdb1 /proc/mounts; then
706763
sudo mount -t xfs -o loop,noatime,nodiratime,nobarrier,logbufs=8 \
707764
${SWIFT_DATA_LOCATION}/drives/images/swift.img ${SWIFT_DATA_LOCATION}/drives/sdb1
708765
fi
@@ -716,7 +773,7 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
716773
tmpd=""
717774
for d in ${SWIFT_DATA_LOCATION}/drives/sdb1/{1..4} \
718775
${SWIFT_CONFIG_LOCATION}/{object,container,account}-server \
719-
${SWIFT_DATA_LOCATION}/{1..4}/node/sdb1 /var/run/swift ;do
776+
${SWIFT_DATA_LOCATION}/{1..4}/node/sdb1 /var/run/swift; do
720777
[[ -d $d ]] && continue
721778
sudo install -o ${USER} -g $USER_GROUP -d $d
722779
done
@@ -770,7 +827,7 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
770827
local log_facility=$3
771828
local node_number
772829

773-
for node_number in {1..4};do
830+
for node_number in {1..4}; do
774831
node_path=${SWIFT_DATA_LOCATION}/${node_number}
775832
sed -e "s,%SWIFT_CONFIG_LOCATION%,${SWIFT_CONFIG_LOCATION},;s,%USER%,$USER,;s,%NODE_PATH%,${node_path},;s,%BIND_PORT%,${bind_port},;s,%LOG_FACILITY%,${log_facility}," \
776833
$FILES/swift/${server_type}-server.conf > ${SWIFT_CONFIG_LOCATION}/${server_type}-server/${node_number}.conf

0 commit comments

Comments
 (0)