Re: [capistrano] Abort capistrano deploy if no puppet exists

41 views
Skip to first unread message

Lee Hambley

unread,
Feb 28, 2013, 11:59:05 AM2/28/13
to capis...@googlegroups.com
Just call out to puppet, when it fails, then your deploy will bail out too.

Essentially this is the best way, beware that it will break if more than one server is involved and some have puppet, and some don't. 

For that reason people often implement a run() with a longer chunk of bash script, so that the script will do the right thing (pull down puppet, then install) or just install if it's already there.

Good luck



On 28 February 2013 16:28, Peter M Souter <p.mo...@gmail.com> wrote:
Hi guys,

Quick question: What would be the best way of making sure a service is installed on the remote server, and then aborting if it's not?

Right now I have something like this: http://pastie.org/6354736

it seems a bit messy, but that's how I've seen it done in other capistrano recipes that run a command that has an exit code.

Thanks!

--
--
* You received this message because you are subscribed to the Google Groups "Capistrano" group.
* To post to this group, send email to capis...@googlegroups.com
* To unsubscribe from this group, send email to capistrano+...@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en
---
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Donovan Bray

unread,
Feb 28, 2013, 10:46:14 PM2/28/13
to capis...@googlegroups.com
That actually only works if you have one server. If you have more than one you risk raising a positive when a different box doesn't have what you are which'ing. 

'which' will set an exit code > 0 if the executable is not found. Cap will abort on a failed command so all you need is

run "which puppet"

Better:

Test and see if it can respond with a more significant request. 

run "puppet agent --fingerprint"

Block deploys:

before :deploy do
   run "puppet agent --fingerprint"
end

YMMV as I don't use puppet. 

Peter M Souter

unread,
Mar 1, 2013, 10:52:36 AM3/1/13
to capis...@googlegroups.com
It's a weird edge case with what I'm doing, as it's an extension of capistrano, it downloads puppet manifests to the remote server then runs them.

I'll add a before step as recomended by dbray! Thanks
Reply all
Reply to author
Forward
0 new messages