@@ -107,7 +107,7 @@ if [[ $EUID -eq 0 ]]; then
107107
108108 # since this script runs as a normal user, we need to give that user
109109 # ability to run sudo
110- dpkg -l sudo || apt_get update && apt_get install sudo
110+ dpkg -l sudo || apt_get update && install_package sudo
111111
112112 if ! getent passwd stack > /dev/null; then
113113 echo " Creating a user called stack"
@@ -268,6 +268,7 @@ function read_password {
268268 set -o xtrace
269269}
270270
271+
271272# Nova Network Configuration
272273# --------------------------
273274
@@ -590,7 +591,7 @@ function get_packages() {
590591
591592# install apt requirements
592593apt_get update
593- apt_get install $( get_packages $FILES /apts)
594+ install_package $( get_packages $FILES /apts)
594595
595596# install python requirements
596597pip_install $( get_packages $FILES /pips | sort -u)
677678# ------
678679
679680if [[ $SYSLOG != " False" ]]; then
680- apt_get install -y rsyslog-relp
681+ install_package rsyslog-relp
681682 if [[ " $SYSLOG_HOST " = " $HOST_IP " ]]; then
682683 # Configure the master host to receive
683684 cat << EOF >/tmp/90-stack-m.conf
692693EOF
693694 sudo mv /tmp/90-stack-s.conf /etc/rsyslog.d
694695 fi
695- sudo /usr/sbin/service rsyslog restart
696+ restart_service rsyslog
696697fi
697698
698699
@@ -703,7 +704,7 @@ if is_service_enabled rabbit; then
703704 # Install and start rabbitmq-server
704705 # the temp file is necessary due to LP: #878600
705706 tfile=$( mktemp)
706- apt_get install rabbitmq-server > " $tfile " 2>&1
707+ install_package rabbitmq-server > " $tfile " 2>&1
707708 cat " $tfile "
708709 rm -f " $tfile "
709710 # change the rabbit password since the default is "guest"
@@ -738,13 +739,13 @@ EOF
738739 fi
739740
740741 # Install and start mysql-server
741- apt_get install mysql-server
742+ install_package mysql-server
742743 # Update the DB to give user ‘$MYSQL_USER’@’%’ full control of the all databases:
743744 sudo mysql -uroot -p$MYSQL_PASSWORD -h127.0.0.1 -e " GRANT ALL PRIVILEGES ON *.* TO '$MYSQL_USER '@'%' identified by '$MYSQL_PASSWORD ';"
744745
745746 # Edit /etc/mysql/my.cnf to change ‘bind-address’ from localhost (127.0.0.1) to any (0.0.0.0) and restart the mysql service:
746747 sudo sed -i ' s/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
747- sudo service mysql restart
748+ restart_service mysql
748749fi
749750
750751# Our screenrc file builder
@@ -801,7 +802,7 @@ screen -r stack -X hardstatus alwayslastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<
801802if is_service_enabled horizon; then
802803
803804 # Install apache2, which is NOPRIME'd
804- apt_get install apache2 libapache2-mod-wsgi
805+ install_package apache2 libapache2-mod-wsgi
805806
806807
807808 # Remove stale session database.
@@ -826,7 +827,7 @@ if is_service_enabled horizon; then
826827 s,%GROUP%,$APACHE_GROUP ,g;
827828 s,%HORIZON_DIR%,$HORIZON_DIR ,g;
828829 " -i /etc/apache2/sites-enabled/000-default
829- sudo service apache2 restart
830+ restart_service apache2
830831fi
831832
832833
@@ -905,8 +906,7 @@ if is_service_enabled q-svc; then
905906 # Install deps
906907 # FIXME add to files/apts/quantum, but don't install if not needed!
907908 kernel_version=` cat /proc/version | cut -d " " -f3`
908- apt_get install linux-headers-$kernel_version
909- apt_get install openvswitch-switch openvswitch-datapath-dkms
909+ install_package openvswitch-switch openvswitch-datapath-dkms linux-headers-$kernel_version
910910 # Create database for the plugin/agent
911911 if is_service_enabled mysql; then
912912 mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e ' DROP DATABASE IF EXISTS ovs_quantum;'
@@ -1019,7 +1019,7 @@ if is_service_enabled n-cpu; then
10191019
10201020 # Virtualization Configuration
10211021 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1022- apt_get install libvirt-bin
1022+ install_package libvirt-bin
10231023
10241024 # Force IP forwarding on, just on case
10251025 sudo sysctl -w net.ipv4.ip_forward=1
@@ -1043,7 +1043,7 @@ if is_service_enabled n-cpu; then
10431043 # to simulate multiple systems.
10441044 if [[ " $LIBVIRT_TYPE " == " lxc" ]]; then
10451045 if [[ " $DISTRO " > natty ]]; then
1046- apt_get install cgroup-lite
1046+ install_package cgroup-lite
10471047 else
10481048 cgline=" none /cgroup cgroup cpuacct,memory,devices,cpu,freezer,blkio 0 0"
10491049 sudo mkdir -p /cgroup
@@ -1062,7 +1062,7 @@ if is_service_enabled n-cpu; then
10621062 # libvirt detects various settings on startup, as we potentially changed
10631063 # the system configuration (modules, filesystems), we need to restart
10641064 # libvirt to detect those changes.
1065- sudo /etc/init.d/ libvirt-bin restart
1065+ restart_service libvirt-bin
10661066
10671067
10681068 # Instance Storage
11131113# Storage Service
11141114if is_service_enabled swift; then
11151115 # Install memcached for swift.
1116- apt_get install memcached
1116+ install_package memcached
11171117
11181118 # We first do a bit of setup by creating the directories and
11191119 # changing the permissions so we can run it as our user.
@@ -1297,7 +1297,7 @@ if is_service_enabled n-vol; then
12971297 # By default, the backing file is 2G in size, and is stored in /opt/stack.
12981298
12991299 # install the package
1300- apt_get install tgt
1300+ install_package tgt
13011301
13021302 if ! sudo vgs $VOLUME_GROUP ; then
13031303 VOLUME_BACKING_FILE=${VOLUME_BACKING_FILE:- $DEST / nova-volumes-backing-file}
0 commit comments