~zulcss/ubuntu/precise/keystone/trunk

« back to all changes in this revision

Viewing changes to debian/keystone.postinst

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Julien Danjou
  • Date: 2012-02-10 10:39:48 UTC
  • Revision ID: package-import@ubuntu.com-20120210103948-ew16th0brq4pjppz
Tags: 2012.1~e4~20120203.1574-0ubuntu2
[Chuck Short]
* debian/control: Moved python-prettytable and added 
  python-dateutil as a build dependency.

[Julien Danjou]
* Add dbconfig support. (LP: #930139)

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
if [ "$1" = "configure" ]
6
6
then
 
7
        . /usr/share/debconf/confmodule
 
8
        . /usr/share/dbconfig-common/dpkg/postinst
 
9
 
7
10
        if ! getent passwd keystone > /dev/null 2>&1
8
11
        then
9
12
        adduser --system --home /var/lib/keystone --no-create-home --shell /bin/bash keystone
12
15
        then
13
16
                addgroup --system keystone >/dev/null
14
17
        fi
 
18
 
 
19
        dbc_go keystone $@
 
20
 
 
21
        case "$dbc_dbtype" in
 
22
            sqlite3)
 
23
                SQL_CONNECTION="sqlite:///$dbc_basepath/$dbc_dbname.db"
 
24
                ;;
 
25
            mysql)
 
26
                [ -n "$dbc_dbport" ] && dbport=:$dbc_dbport
 
27
                SQL_CONNECTION="mysql://$dbc_dbuser:$dbc_dbpass@${dbc_dbserver:-localhost}$dbport/$dbc_dbname"
 
28
                ;;
 
29
            pgsql)
 
30
                [ -n "$dbc_dbport" ] && dbport=:$dbc_dbport
 
31
                SQL_CONNECTION="pgsql://$dbc_dbuser:$dbc_dbpass@${dbc_dbserver:-localhost}$dbport/$dbc_dbname"
 
32
                ;;
 
33
            *)
 
34
                SQL_CONNECTION="sqlite:////var/lib/keystone/keystone.db"
 
35
                ;;
 
36
        esac
 
37
 
 
38
        [ -z "$2" -o "$dbc_install" = "true" ] \
 
39
            && sed -e "s,_DBC_URL_,$SQL_CONNECTION," -i /etc/keystone/keystone.conf
 
40
 
 
41
        if [ "$dbc_install" = "true" ]
 
42
        then
 
43
            # On first install, create basics configuration and add roles
 
44
            if [ -z "$2" ]
 
45
            then
 
46
                sed -e "s,_DBC_URL_,$SQL_CONNECTION," -i /etc/keystone/keystone.conf
 
47
 
 
48
                keystone-manage database sync
 
49
                keystone-manage role add Admin
 
50
                keystone-manage role add Member
 
51
                keystone-manage role add KeystoneAdmin
 
52
                keystone-manage role add KeystoneServiceAdmin
 
53
                keystone-manage role add sysadmin
 
54
                keystone-manage role add netadmin
 
55
            fi
 
56
 
 
57
            if [ "$dbc_upgrade" = "true" ]
 
58
            then
 
59
                su -s /bin/sh -c 'exec keystone-manage db sync' keystone
 
60
            fi
 
61
        fi
15
62
        chown keystone:keystone -R /var/lib/keystone/ /var/log/keystone/ /etc/keystone/
16
63
        chmod 0700 /var/lib/keystone/ /var/log/keystone/ /etc/keystone/
17
64
fi