Message from discussion
Identify current host
Received: by 10.142.82.6 with SMTP id f6mr383241wfb.0.1246668456512;
Fri, 03 Jul 2009 17:47:36 -0700 (PDT)
Return-Path: <gary.richard...@gmail.com>
Received: from mail-px0-f175.google.com (mail-px0-f175.google.com [209.85.216.175])
by gmr-mx.google.com with ESMTP id k19si1355721waf.4.2009.07.03.17.47.35;
Fri, 03 Jul 2009 17:47:35 -0700 (PDT)
Received-SPF: pass (google.com: domain of gary.richard...@gmail.com designates 209.85.216.175 as permitted sender) client-ip=209.85.216.175;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of gary.richard...@gmail.com designates 209.85.216.175 as permitted sender) smtp.mail=gary.richard...@gmail.com; dkim=pass (test mode) header...@gmail.com
Received: by mail-px0-f175.google.com with SMTP id 5so2498730pxi.11
for <capistrano@googlegroups.com>; Fri, 03 Jul 2009 17:47:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=gamma;
h=domainkey-signature:mime-version:received:date:message-id:subject
:from:to:content-type;
bh=8k+6HDJbuaUTzjG6xexuinRO0V6TL+vjOwQSHzY/of4=;
b=X/PEtsalxgSM1h3ALndN0ktMbJIDVtzUPWIisQfUNgIuI4FH/kStLdhXZFdkRc7wYX
m2YhYdTSnqVtts/sL4/WmWaSpIwnuKg6hATUM8ie6bB0O2KlidTfaIA6cOLoOlIyUBmG
Jsl63vR/bdzjFTpgo+i13U3lhQr8Dt3stjXIo=
DomainKey-Signature: a=rsa-sha1; c=nofws;
d=gmail.com; s=gamma;
h=mime-version:date:message-id:subject:from:to:content-type;
b=DqJc7A8lL1C9Fd6UogaXfzURB+HLLJ3dR2LiNL+eo3ZiK4zWR2rgyhK4KMmUIaW7LX
gJ5fq9tEp0cdsPlHE8ipjtLkfglAeua+qES+N2Is4sHUYRTutLr/BRzIQwH0T3jdcOPI
uaKJicipPfnzC3XhsES6U1I/hyrjmTrLUF7fU=
MIME-Version: 1.0
Received: by 10.142.109.16 with SMTP id h16mr660603wfc.309.1246668455266; Fri,
03 Jul 2009 17:47:35 -0700 (PDT)
Date: Fri, 3 Jul 2009 17:47:35 -0700
Message-ID: <be2921990907031747g35a66441w15eecfc687165b3b@mail.gmail.com>
Subject: Identify current host
From: Gary Richardson <gary.richard...@gmail.com>
To: capistrano@googlegroups.com
Content-Type: multipart/alternative; boundary=001636e1fca96dc9a5046dd69e92
--001636e1fca96dc9a5046dd69e92
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Hey,
Two part question that I haven't been able to answer:
1) can I get the current host a task is executing on? I've read some stuff
about $CAPISTRANO:HOST$, but it doesn't seem to work for me
2) if I have an array of values (let's say an array that maps ec2 host names
to ec2 instance id's), can I use this same method to look up something from
that array?
For example:
task :example do
instanceId = lookUpTable[hostname]
run "somecommand -h #{hostname} -i #{instanceid}"
done
PS, the error I get when I run a task with $CAPISTRANO:HOST$ is:
* executing "echo $CAPISTRANO:HOST$"
/usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/lib/capistrano/server_definition.rb:16:in
`initialize': undefined method `match' for 101:Fixnum (NoMethodError)
from
/usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/lib/capistrano/role.rb:80:in
`new'
from
/usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/lib/capistrano/role.rb:80:in
`wrap_server'
from
/usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/lib/capistrano/role.rb:98:in
`wrap_list'
from
/usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/lib/capistrano/role.rb:97:in
`map'
from
/usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/lib/capistrano/role.rb:97:in
`wrap_list'
from
/usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/lib/capistrano/role.rb:59:in
`to_ary'
from
/usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/lib/capistrano/role.rb:74:in
`concat'
from
/usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/lib/capistrano/role.rb:74:in
`dynamic_servers'
... 28 levels...
from
/usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/lib/capistrano/cli/execute.rb:14:in
`execute'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/bin/cap:4
from /usr/bin/cap:16:in `load'
from /usr/bin/cap:16
Thanks!
--001636e1fca96dc9a5046dd69e92
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hey,<div><br></div><div>Two part question that I haven't been able to a=
nswer:</div><div><br></div><div>1) can I get the current host a task is exe=
cuting on? I've read some stuff about $CAPISTRANO:HOST$, but it doesn&#=
39;t seem to work for me</div>
<div>2) if I have an array of values (let's say an array that maps ec2 =
host names to ec2 instance id's), can I use this same method to look up=
something from that array?</div><div><br></div><div>For example:</div>
<div><br></div><div>task :example do</div><div>=A0=A0instanceId =3D lookUpT=
able[hostname]</div><div>=A0=A0run "somecommand -h #{hostname} -i #{in=
stanceid}"</div><div>done</div><div><br></div><div>PS, the error I get=
when I run a task with $CAPISTRANO:HOST$ is:</div>
<div><br></div><div><div>=A0=A0* executing "echo $CAPISTRANO:HOST$&quo=
t;</div><div>/usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/lib/capistrano/se=
rver_definition.rb:16:in `initialize': undefined method `match' for=
101:Fixnum (NoMethodError)</div>
<div>=A0=A0 =A0 =A0 =A0from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/li=
b/capistrano/role.rb:80:in `new'</div><div>=A0=A0 =A0 =A0 =A0from /usr/=
lib/ruby/gems/1.8/gems/capistrano-2.5.5/lib/capistrano/role.rb:80:in `wrap_=
server'</div>
<div>=A0=A0 =A0 =A0 =A0from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/li=
b/capistrano/role.rb:98:in `wrap_list'</div><div>=A0=A0 =A0 =A0 =A0from=
/usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/lib/capistrano/role.rb:97:in =
`map'</div><div>
=A0=A0 =A0 =A0 =A0from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/lib/cap=
istrano/role.rb:97:in `wrap_list'</div><div>=A0=A0 =A0 =A0 =A0from /usr=
/lib/ruby/gems/1.8/gems/capistrano-2.5.5/lib/capistrano/role.rb:59:in `to_a=
ry'</div><div>
=A0=A0 =A0 =A0 =A0from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/lib/cap=
istrano/role.rb:74:in `concat'</div><div>=A0=A0 =A0 =A0 =A0from /usr/li=
b/ruby/gems/1.8/gems/capistrano-2.5.5/lib/capistrano/role.rb:74:in `dynamic=
_servers'</div>
<div>=A0=A0 =A0 =A0 =A0 ... 28 levels...</div><div>=A0=A0 =A0 =A0 =A0from /=
usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/lib/capistrano/cli/execute.rb:1=
4:in `execute'</div><div>=A0=A0 =A0 =A0 =A0from /usr/lib/ruby/gems/1.8/=
gems/capistrano-2.5.5/bin/cap:4</div>
<div>=A0=A0 =A0 =A0 =A0from /usr/bin/cap:16:in `load'</div><div>=A0=A0 =
=A0 =A0 =A0from /usr/bin/cap:16</div><div><br></div></div><div><br></div><d=
iv>Thanks!</div>
--001636e1fca96dc9a5046dd69e92--