From 03412fe2cee41990c101ba69ab40db871467754f Mon Sep 17 00:00:00 2001 From: Mihai Prica Date: Tue, 11 Jun 2013 14:37:05 +0300 Subject: python-keystone: Added initscript Signed-off-by: Mihai Prica --- .../python/python-keystone/keystone | 66 ++++++++++++++++++++++ .../python/python-keystone_2013.1.bb | 12 +++- 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 meta-openstack/recipes-devtools/python/python-keystone/keystone (limited to 'meta-openstack/recipes-devtools/python') diff --git a/meta-openstack/recipes-devtools/python/python-keystone/keystone b/meta-openstack/recipes-devtools/python/python-keystone/keystone new file mode 100644 index 0000000..bdcfcc7 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-keystone/keystone @@ -0,0 +1,66 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: keystone +# Short-Description: OpenStack Identity Service +### END INIT INFO + +DESC="keystone" +DAEMON="/usr/bin/keystone-all" +PIDFILE="/var/run/keystone-all.pid" + +start () +{ + if [ -e $PIDFILE ]; then + PIDDIR=/proc/$(cat $PIDFILE) + if [ -d ${PIDDIR} ]; then + echo "$DESC already running." + exit 1 + else + echo "Removing stale PID file $PIDFILE" + rm -f $PIDFILE + fi + fi + + echo -n "Starting $DESC..." + + start-stop-daemon --start --quiet --background \ + --pidfile ${PIDFILE} --make-pidfile --exec ${DAEMON} + + if [ $? -eq 0 ]; then + echo "done." + else + echo "failed." + fi +} + +stop () +{ + echo -n "Stopping $DESC..." + start-stop-daemon --stop --quiet --pidfile $PIDFILE + if [ $? -eq 0 ]; then + echo "done." + else + echo "failed." + fi + rm -f $PIDFILE +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|force-reload) + stop + start + ;; + *) + echo "Usage: $0 {start|stop|force-reload|restart}" + exit 1 + ;; +esac + +exit 0 diff --git a/meta-openstack/recipes-devtools/python/python-keystone_2013.1.bb b/meta-openstack/recipes-devtools/python/python-keystone_2013.1.bb index b543b13..d80f9bb 100644 --- a/meta-openstack/recipes-devtools/python/python-keystone_2013.1.bb +++ b/meta-openstack/recipes-devtools/python/python-keystone_2013.1.bb @@ -11,6 +11,7 @@ SRC_URI = "https://launchpad.net/keystone/grizzly/${PV}/+download/${SRCNAME}-${P file://keystone.conf \ file://identity.sh \ file://openrc \ + file://keystone \ " SRC_URI[md5sum] = "f82189cd7e3f0955e32c60e41f4120da" @@ -18,7 +19,7 @@ SRC_URI[sha256sum] = "34347a3242a40d93b98c3722e6f3fbc112bc1c9ef20c045c3d40637e45 S = "${WORKDIR}/${SRCNAME}-${PV}" -inherit setuptools +inherit setuptools update-rc.d SERVICE_TOKEN = "password" @@ -36,6 +37,11 @@ do_install_append() { install -m 600 ${S}/etc/logging.conf.sample ${KEYSTONE_CONF_DIR}/logging.conf install -m 600 ${S}/etc/policy.json ${KEYSTONE_CONF_DIR}/policy.json + if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/keystone ${D}${sysconfdir}/init.d/keystone + fi + # Create the sqlite database touch ${KEYSTONE_CONF_DIR}/keystone.db } @@ -53,6 +59,7 @@ pkg_postinst_${SRCNAME} () { keystone-manage pki_setup # quick fix echo "source /etc/keystone/openrc" > /home/root/.bashrc + /etc/init.d/keystone start sleep 1 bash /etc/keystone/identity.sh } @@ -83,3 +90,6 @@ RDEPENDS_${PN} += "python-pam \ RDEPENDS_${SRCNAME} = "${PN} \ postgresql postgresql-client python-psycopg2" + +INITSCRIPT_PACKAGES = "${SRCNAME}" +INITSCRIPT_NAME_${SRCNAME} = "keystone" -- cgit v1.2.3-54-g00ecf