diff options
Diffstat (limited to 'meta-openstack/recipes-dangling/postgresql/postgresql/postgresql-init')
-rw-r--r-- | meta-openstack/recipes-dangling/postgresql/postgresql/postgresql-init | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/meta-openstack/recipes-dangling/postgresql/postgresql/postgresql-init b/meta-openstack/recipes-dangling/postgresql/postgresql/postgresql-init deleted file mode 100644 index c9c38073..00000000 --- a/meta-openstack/recipes-dangling/postgresql/postgresql/postgresql-init +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -# set -x - -PN=postgresql -CONTROLLER_IP=%CONTROLLER_IP% -COMPUTE_IP=%COMPUTE_IP% -DB_USER=%DB_USER% -DB_PASSWORD=%DB_PASSWORD% - -if [ -e /etc/${PN}/PG_VERSION ]; then - # the database has already been initialized, return - exit 0 -fi - -sudo -u postgres initdb -D /etc/${PN}/ -echo "listen_addresses = '*'" >> /etc/${PN}/postgresql.conf -echo "host all all ${CONTROLLER_IP}/32 trust" >> /etc/${PN}/pg_hba.conf -echo "host all all ${COMPUTE_IP}/32 trust" >> /etc/${PN}/pg_hba.conf -/etc/init.d/postgresql start - -count=0 -done=0 -while [ $count -le 10 ] && [ $done -eq 0 ]; do - sudo -u postgres psql -c "CREATE ROLE ${DB_USER} WITH SUPERUSER LOGIN PASSWORD '${DB_PASSWORD}'" 2> /dev/null - if [ $? -ne 0 ]; then - echo "[INFO] postgres: failed to create account for ${DB_USER}, trying again" - /etc/init.d/postgresql stop - sleep 3 - /etc/init.d/postgresql start - sleep 3 - else - echo "[INFO] postgres: created account for ${DB_USER}, continuing .. " - done=1 - fi - count=`expr $count + 1` -done - -if [ $done -eq 0 ]; then - echo "[ERROR] postgres: unable to create admin account" - exit 1 -fi - -ln -s /usr/share/zoneinfo /usr/share/postgresql/timezone || true |