~ubuntu-branches/ubuntu/trusty/heat/trusty-security

« back to all changes in this revision

Viewing changes to bin/heat-db-setup

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Yolanda Robla, Chuck Short
  • Date: 2013-07-22 16:22:29 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130722162229-zzvfu40id94ii0hc
Tags: 2013.2~b2-0ubuntu1
[ Yolanda Robla ]
* debian/tests: added autopkg tests

[ Chuck Short ]
* New upstream release
* debian/control:
  - Add python-pbr to build-depends.
  - Add python-d2to to build-depends.
  - Dropped python-argparse.
  - Add python-six to build-depends.
  - Dropped python-sendfile.
  - Dropped python-nose.
  - Added testrepository.
  - Added python-testtools.
* debian/rules: Run testrepository instead of nosetets.
* debian/patches/removes-lxml-version-limitation-from-pip-requires.patch: Dropped
  no longer needed.
* debian/patches/fix-package-version-detection-when-building-doc.patch: Dropped
  no longer needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
}
59
59
 
60
60
start_mysql_server() {
61
 
        sudo $SERVICE_START
 
61
        $SERVICE_START
62
62
}
63
63
 
64
64
MYSQL_HEAT_PW_DEFAULT="heat"
65
65
MYSQL_HEAT_PW=${MYSQL_HEAT_PW_DEFAULT}
66
66
HEAT_CONFIG="/etc/heat/heat-engine.conf"
67
67
ASSUME_YES=""
 
68
ELEVATE=""
 
69
 
 
70
# Check for root privileges
 
71
if [[ $EUID -ne 0 ]] ; then
 
72
        echo "This operation requires superuser privileges, using sudo:"
 
73
        if sudo -l > /dev/null ; then
 
74
                ELEVATE="sudo"
 
75
        else
 
76
                exit 1
 
77
        fi
 
78
fi
68
79
 
69
80
case "$1" in
70
81
        rpm)
71
82
                echo "Installing on an RPM system."
72
 
                PACKAGE_INSTALL="yum install"
 
83
                PACKAGE_INSTALL="$ELEVATE yum install"
73
84
                PACKAGE_STATUS="rpm -q"
74
85
                SERVICE_MYSQLD="mysqld"
75
 
                SERVICE_START="service $SERVICE_MYSQLD start"
 
86
                SERVICE_START="$ELEVATE service $SERVICE_MYSQLD start"
76
87
                SERVICE_STATUS="service $SERVICE_MYSQLD status"
77
 
                SERVICE_ENABLE="chkconfig"
 
88
                SERVICE_ENABLE="$ELEVATE chkconfig"
78
89
                ;;
79
90
        deb)
80
91
                echo "Installing on a Debian system."
81
 
                PACKAGE_INSTALL="apt-get install"
 
92
                PACKAGE_INSTALL="$ELEVATE apt-get install"
82
93
                PACKAGE_STATUS="dpkg-query -s"
83
94
                SERVICE_MYSQLD="mysql"
84
 
                SERVICE_START="service $SERVICE_MYSQLD start"
85
 
                SERVICE_STATUS="service $SERVICE_MYSQLD status"
 
95
                SERVICE_START="$ELEVATE service $SERVICE_MYSQLD start"
 
96
                SERVICE_STATUS="$ELEVATE service $SERVICE_MYSQLD status"
86
97
                SERVICE_ENABLE=""
87
98
                ;;
88
99
        *)
118
129
# Make sure MySQL is installed.
119
130
 
120
131
NEW_MYSQL_INSTALL=0
121
 
if ! $PACKAGE_STATUS mysql-server > /dev/null
 
132
if ! $PACKAGE_STATUS mysql-server && ! $PACKAGE_STATUS mariadb-server > /dev/null
122
133
then
123
134
        if [ -z "${ASSUME_YES}" ] ; then
124
135
                printf "mysql-server is not installed.  Would you like to install it now? (y/n): "
238
249
        sed -i -e "s/mysql:\/\/heat:\(.*\)@/mysql:\/\/heat:${MYSQL_HEAT_PW}@/" ${HEAT_CONFIG}
239
250
fi
240
251
 
241
 
python -m heat.db.sync
 
252
heat-manage db_sync
242
253
 
243
254
 
244
255
# Do a final sanity check on the database.