[openstack-keystone/el6-havana] ensure service start waits until service is available

Pádraig Brady pbrady at fedoraproject.org
Tue Jul 23 18:33:21 UTC 2013


commit 9e75c946a07c8f81e7dbbbdd98df3a68a68ce7e3
Author: Pádraig Brady <P at draigBrady.com>
Date:   Tue Jul 23 19:23:44 2013 +0100

    ensure service start waits until service is available
    
    Packstack at least requires this in place as per:
    http://bugzilla.redhat.com/987530

 openstack-keystone.init |   20 ++++++++++++++++++++
 openstack-keystone.spec |    5 ++++-
 2 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/openstack-keystone.init b/openstack-keystone.init
index 084fcc8..3dedad3 100755
--- a/openstack-keystone.init
+++ b/openstack-keystone.init
@@ -19,6 +19,25 @@ pidfile="/var/run/$prog/$prog.pid"
 
 lockfile=/var/lock/subsys/$prog
 
+keystone_available()
+{
+    keystone discover 2>&1 | grep -qFi "Keystone found"
+}
+
+# Wait at most 10s for the service to become available
+wait_until_keystone_available()
+{
+    tries=0
+    until keystone_available; do
+        rh_status_q || return 1
+        tries=$(($tries + 1))
+        [ $tries -eq 20 ] && { echo 'Aborting wait for keystone to start' >&2; return 1; }
+        sleep .5
+    done
+
+    return 0;
+}
+
 start() {
     [ -x $exec ] || exit 5
     [ -f $config ] || exit 6
@@ -27,6 +46,7 @@ start() {
     retval=$?
     echo
     [ $retval -eq 0 ] && touch $lockfile
+    [ $retval -eq 0 ] && wait_until_keystone_available
     return $retval
 }
 
diff --git a/openstack-keystone.spec b/openstack-keystone.spec
index 4fd1802..74bc397 100644
--- a/openstack-keystone.spec
+++ b/openstack-keystone.spec
@@ -8,7 +8,7 @@
 
 Name:           openstack-keystone
 Version:        2013.2
-Release:        0.4.b%{milestone}%{?dist}
+Release:        0.5.b%{milestone}%{?dist}
 Summary:        OpenStack Identity Service
 
 License:        ASL 2.0
@@ -239,6 +239,9 @@ fi
 %endif
 
 %changelog
+* Tue Jul 23 2013 pbrady at redhat.com 2013.2-0.5.b2
+- Ensure service start waits until service is available
+
 * Thu Jul 18 2013 pbrady at redhat.com 2013.2-0.4.b2
 - havana-2 milestone
 


More information about the scm-commits mailing list