diff options
| author | Mark Asselstine <mark.asselstine@windriver.com> | 2017-11-22 11:08:46 -0500 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2017-11-27 10:39:51 -0500 |
| commit | fc1d523aa0f734ec88907f5b4ecc510d8fa56f51 (patch) | |
| tree | a0cc468741ea2449683fb93fc17b7756de9e61f3 /meta-openstack/recipes-devtools/python/python-keystone/keystone | |
| parent | 54c4cb239e3bfd8d9efe75f073aef8e4a671bc7b (diff) | |
| download | meta-cloud-services-fc1d523aa0f734ec88907f5b4ecc510d8fa56f51.tar.gz | |
python-keystone: get things working with stable/pike
Since we need to ensure the setup is run after postgresql is setup and
running we can't use a postinst as it runs too early in the boot
process. Instead we have a simple service which will run after
postgresql-init to complete the setup. On completion the service
disables itself, avoiding being run again on subsequent boots.
Update configuration data to match keystone setup as described on the
upstream project pages.
Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-keystone/keystone')
| -rw-r--r-- | meta-openstack/recipes-devtools/python/python-keystone/keystone | 128 |
1 files changed, 0 insertions, 128 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-keystone/keystone b/meta-openstack/recipes-devtools/python/python-keystone/keystone deleted file mode 100644 index 34cc3ad..0000000 --- a/meta-openstack/recipes-devtools/python/python-keystone/keystone +++ /dev/null | |||
| @@ -1,128 +0,0 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | ### BEGIN INIT INFO | ||
| 4 | # Provides: keystone | ||
| 5 | # Required-Start: $remote_fs $network $syslog | ||
| 6 | # Required-Stop: $remote_fs $syslog | ||
| 7 | # Default-Start: 3 5 | ||
| 8 | # Default-Stop: 0 1 2 6 | ||
| 9 | # Short-Description: Keystone Server | ||
| 10 | # Description: OpenStack identity Service (code-named keystone) | ||
| 11 | ### END INIT INFO | ||
| 12 | |||
| 13 | DESC="keystone" | ||
| 14 | DAEMON="uwsgi" | ||
| 15 | DAEMON_OPTIONS="--http 127.0.0.1:35357 --wsgi-file $(which keystone-wsgi-admin)" | ||
| 16 | PIDFILE="/var/run/keystone-all.pid" | ||
| 17 | |||
| 18 | start () | ||
| 19 | { | ||
| 20 | if [ -e $PIDFILE ]; then | ||
| 21 | PIDDIR=/proc/$(cat $PIDFILE) | ||
| 22 | if [ -d ${PIDDIR} ]; then | ||
| 23 | echo "$DESC already running." | ||
| 24 | exit 1 | ||
| 25 | else | ||
| 26 | echo "Removing stale PID file $PIDFILE" | ||
| 27 | rm -f $PIDFILE | ||
| 28 | fi | ||
| 29 | fi | ||
| 30 | |||
| 31 | if [ ! -d /var/log/keystone ]; then | ||
| 32 | mkdir /var/log/keystone | ||
| 33 | fi | ||
| 34 | echo -n "Starting $DESC..." | ||
| 35 | |||
| 36 | start-stop-daemon --start --quiet --background \ | ||
| 37 | --pidfile ${PIDFILE} --make-pidfile --exec ${DAEMON} \ | ||
| 38 | -- ${DAEMON_OPTIONS} | ||
| 39 | |||
| 40 | if [ $? -eq 0 ]; then | ||
| 41 | echo "done." | ||
| 42 | else | ||
| 43 | echo "failed." | ||
| 44 | fi | ||
| 45 | } | ||
| 46 | |||
| 47 | stop () | ||
| 48 | { | ||
| 49 | echo -n "Stopping $DESC..." | ||
| 50 | start-stop-daemon --stop --quiet --pidfile $PIDFILE | ||
| 51 | if [ $? -eq 0 ]; then | ||
| 52 | echo "done." | ||
| 53 | else | ||
| 54 | echo "failed." | ||
| 55 | fi | ||
| 56 | rm -f $PIDFILE | ||
| 57 | } | ||
| 58 | |||
| 59 | status() | ||
| 60 | { | ||
| 61 | pid=`cat $PIDFILE 2>/dev/null` | ||
| 62 | if [ -n "$pid" ]; then | ||
| 63 | if ps -p $pid > /dev/null 2>&1 ; then | ||
| 64 | echo "$DESC is running" | ||
| 65 | return | ||
| 66 | fi | ||
| 67 | fi | ||
| 68 | echo "$DESC is not running" | ||
| 69 | } | ||
| 70 | |||
| 71 | reset() | ||
| 72 | { | ||
| 73 | # Cleanup keystone tenant | ||
| 74 | . /etc/nova/openrc | ||
| 75 | simple_delete "keystone user-list" "keystone user-delete" 1 "keystone user" | ||
| 76 | simple_delete "keystone tenant-list" "keystone tenant-delete" 1 "keystone tenant" | ||
| 77 | simple_delete "keystone role-list" "keystone role-delete" 1 "keystone role" | ||
| 78 | simple_delete "keystone endpoint-list" "keystone endpoint-delete" 1 "keystone endpoint" | ||
| 79 | simple_delete "keystone service-list" "keystone service-delete" 1 "keystone service" | ||
| 80 | |||
| 81 | stop | ||
| 82 | |||
| 83 | # This is to make sure postgres is configured and running | ||
| 84 | if ! pidof postmaster > /dev/null; then | ||
| 85 | /etc/init.d/postgresql-init | ||
| 86 | /etc/init.d/postgresql start | ||
| 87 | sleep 2 | ||
| 88 | fi | ||
| 89 | |||
| 90 | sudo -u postgres dropdb keystone | ||
| 91 | sudo -u postgres createdb keystone | ||
| 92 | keystone-manage db_sync | ||
| 93 | keystone-manage pki_setup --keystone-user=root --keystone-group=root | ||
| 94 | |||
| 95 | start | ||
| 96 | |||
| 97 | sleep 2 | ||
| 98 | |||
| 99 | ADMIN_PASSWORD=%ADMIN_PASSWORD% \ | ||
| 100 | SERVICE_PASSWORD=%SERVICE_PASSWORD% \ | ||
| 101 | SERVICE_TENANT_NAME=%SERVICE_TENANT_NAME% \ | ||
| 102 | bash /etc/keystone/service-user-setup | ||
| 103 | } | ||
| 104 | |||
| 105 | case "$1" in | ||
| 106 | start) | ||
| 107 | start | ||
| 108 | ;; | ||
| 109 | stop) | ||
| 110 | stop | ||
| 111 | ;; | ||
| 112 | restart|force-reload|reload) | ||
| 113 | stop | ||
| 114 | start | ||
| 115 | ;; | ||
| 116 | status) | ||
| 117 | status | ||
| 118 | ;; | ||
| 119 | reset) | ||
| 120 | reset | ||
| 121 | ;; | ||
| 122 | *) | ||
| 123 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status|reset}" | ||
| 124 | exit 1 | ||
| 125 | ;; | ||
| 126 | esac | ||
| 127 | |||
| 128 | exit 0 | ||
