--- recipes/aeolus_recipe/manifests/conductor.pp | 9 +-------- 1 files changed, 1 insertions(+), 8 deletions(-)
diff --git a/recipes/aeolus_recipe/manifests/conductor.pp b/recipes/aeolus_recipe/manifests/conductor.pp index e7a20f5..fe9d124 100644 --- a/recipes/aeolus_recipe/manifests/conductor.pp +++ b/recipes/aeolus_recipe/manifests/conductor.pp @@ -51,13 +51,6 @@ class aeolus::conductor inherits aeolus { Rails::Migrate::Db[migrate_aeolus_database], Service['condor', 'httpd']] }
- # XXX ugly hack but iwhd might take some time to come up - exec{"conductor_startup": - command => "/bin/sleep 2", - unless => '/usr/bin/curl http://localhost/conductor', - logoutput => true, - require => Service['aeolus-conductor']} - service{ 'aeolus-connector': ensure => 'running', enable => true, @@ -276,7 +269,7 @@ define aeolus::conductor::login($user,$password){ -d commit=submit \ -c /tmp/aeolus-${user}.cookie", onlyif => "/usr/bin/test ! -f /tmp/aeolus-${user}.cookie || "" == "`curl -X GET http://localhost/conductor -b /tmp/aeolus-${user}.cookie -i --silent | grep 'HTTP/1.1 200'`"", - require => Exec['conductor_startup']} + require => Service['aeolus-conductor']} }
define aeolus::conductor::logout($user){
--- aeolus-conductor.spec.in | 4 ++++ conf/aeolus-conductor | 37 +++++++++++++++++++++++++++++-------- 2 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/aeolus-conductor.spec.in b/aeolus-conductor.spec.in index 26297ff..f1b71b9 100644 --- a/aeolus-conductor.spec.in +++ b/aeolus-conductor.spec.in @@ -49,6 +49,10 @@ Requires: condor >= 7.5.6-2dcloud Requires: iwhd Requires: aeolus-configure
+# to ensure the service is actually started +# and is accessible in the init script +Requires: curl + BuildRequires: ruby BuildRequires: ruby-devel BuildRequires: classads-devel >= 1.0 diff --git a/conf/aeolus-conductor b/conf/aeolus-conductor index a7b84a7..9a4bd84 100755 --- a/conf/aeolus-conductor +++ b/conf/aeolus-conductor @@ -26,23 +26,44 @@ THIN_PROG=thin ADDR=127.0.0.1 RETVAL=0
+STARTTIMEOUT=20 + . /etc/init.d/functions
start() { echo -n "Starting aeolus-conductor: " + if [ -f $THIN_PID ] && checkpid `cat $THIN_PID` ; then + echo_failure + echo + echo "Thin is already running" + exit 1 + fi
$THIN_PROG start -c $CONDUCTOR_DIR -l $THIN_LOG -P $THIN_PID \ - -a $ADDR -e $RAILS_ENV --user $AEOLUS_USER --group $AEOLUS_GROUP \ - -d --prefix=$PREFIX -A $ADAPTER + -a $ADDR -e $RAILS_ENV --user $AEOLUS_USER --group $AEOLUS_GROUP \ + -d --prefix=$PREFIX -A $ADAPTER RETVAL=$? - if [ $RETVAL -eq 0 ] && touch $THIN_LOCKFILE ; then - echo_success - echo - else - echo_failure - echo + if [ $RETVAL -eq 0 ] ; then + # wait until we can contact the server + # this bit is based on what the mysql init script does + TIMEOUT="$STARTTIMEOUT" + while [ $TIMEOUT -gt 0 ]; do + /usr/bin/curl --silent http://$ADDR:3000$PREFIX >& /dev/null + RETVAL=$? + if [ $RETVAL -eq 0 ] ; then + touch $THIN_LOCKFILE + echo_success + echo + exit 0 + fi + sleep 1 + let TIMEOUT=${TIMEOUT}-1 + done fi
+ echo_failure + echo + exit 1 }
stop() {
Arg, switched the order of these and my prefix message seemed to get lost along the way.
Regardless these patches should still work as intended and should be good to go.
-Mo
On Mon, Mar 28, 2011 at 02:37:19PM -0400, Mo Morsi wrote:
Arg, switched the order of these and my prefix message seemed to get lost along the way.
Regardless these patches should still work as intended and should be good to go.
-Mo
Works perfectly, ACK to both patches.
-- Matt
aeolus-devel@lists.fedorahosted.org