On 09/02/10 10:06, Robin Bowes wrote:
> On 09/02/10 09:52, Rory Gibson wrote:
>> Use multi-stage, and simply point all the roles you need at the same box.
>> Doing this on a current project and it all works fine.
>
> You say that like I should know what you mean, Rory. :)
>
> I'll go and read up on multi-stage and come back if I have further
> questions.
OK, so I'm getting the hang of multi-stage.
In my original config, I had stuff like this:
role :partition do
enum_partition
end
task :enum_partition, :roles => [:puppet_masters] do
desc "Enumerate hosts that are partition servers from puppet DB"
cmd = 'sc_hosts.rb --class profile::partition'
capture(cmd).each do |host|
next unless host.chomp
role(:partition, host)
role(:web, host)
end
end
So, I thought I'd simply move the enum tasks to dev.rb and prod.rb and
do different things for each stage.
This seems to work fine for prod, but in dev I want to have empty lists,
ie. :partition will be empty, but cap doesn't seem to like that.
For example, I have this in dev.rb:
task :enum_partition, :roles => [:puppet_masters] do
desc "Enumerate hosts that are partition servers from puppet DB"
# noop in dev
end
This fails with:
* executing `enum_partition'
servers: ["Enumerate hosts that are partition servers from puppet
DB", "b006.private.b.statcounter.com", "Enumerate hosts that are
partition master servers from puppet DB"]
*** [deploy:update_code] rolling back
* executing "rm -rf
/srv/www/apps/queue_processor/releases/20100209130511; true"
servers: ["Enumerate hosts that are partition servers from puppet
DB", "b006.private.b.statcounter.com", "Enumerate hosts that are
partition master servers from puppet DB"]
** [deploy:update_code] exception while rolling back:
Capistrano::ConnectionError, connection failed for: Enumerate hosts that
are partition servers from puppet DB (SocketError: getaddrinfo: Name or
service not known), Enumerate hosts that are partition master servers
from puppet DB (SocketError: getaddrinfo: Name or service not known)
connection failed for: Enumerate hosts that are partition servers from
puppet DB (SocketError: getaddrinfo: Name or service not known),
Enumerate hosts that are partition master servers from puppet DB
(SocketError: getaddrinfo: Name or service not known)
I'm guessing this is because puppet doesn't like the empty list?
I was expecting it would work like "do this task on this list of hosts
and if the list of hosts is empty then do nothing" but that seems not to
be the case?
R.
--
* You received this message because you are subscribed to the Google Groups
"Capistrano" group.
* To post to this group, send email to [email protected]
* To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/capistrano?hl=en