Hi
Version 1
  task :check_lb_worker_exists, :roles => :apacluster, :on_error
=> :abort do
    if exists?(:modjk_loadbalancerworker) then
      begin
        run "if wget #{wgetparams} 'http://$CAPISTRANO:HOST$/jkserver-
status?cmd=edit&from=list&w=#{modjk_loadbalancerworker}' | grep
'ERROR'; then false;else true;fi  2>&2>/dev/null;"
      rescue
        puts "The specified modjk load balancer worker does not
exists"
      end
    end
  end#task


calling the task:
task :preflightcheck, :on_error => :abort do
  unless exists?(:app_path)
    abort "The download path variable app_path has not been specified"
  end

  modjk.check_lb_worker_exists

  puts 'Everything is fine'
end

This version works fine except that everything is always fine
"regardless whether the check_lb_worker_exists failed or not

version 2
~~~~~~~

  task :check_lb_worker_exists, :roles => :apacluster, :on_error
=> :abort do
    if exists?(:modjk_loadbalancerworker) then
        run "if wget #{wgetparams} 'http://$CAPISTRANO:HOST$/jkserver-
status?cmd=edit&from=list&w=#{modjk_loadbalancerworker}' | grep
'ERROR'; then false;else true;fi  ;"
    end
  end#task

task :preflightcheck, :on_error => :abort do
  unless exists?(:app_path)
    abort "The download path variable app_path has not been specified"
  end

  unless not modjk.check_lb_worker_exists

    abort 'horribly broken'
  end

  puts 'all looks fine!'
end

In version two if the check_lb_worker task fails that failure does not
get handled by the unless abort block in the main preflight check.

Basically I am trying to do the following:

task preflight
  unless run(some command) fail
  unless run_task_check1, fail with nice message
  unless run_task_check2, fail with nice message

  if nothing failed then put "everything looks ok"
end

I am struggling to get the final "everything looks ok" message to
display only if everything really is ok because at the moment it
displays regardless. I hope this is all making some kind of sense...
otherwise I will have to try again.

Regards
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to