Message from discussion
Identify current host
Received: by 10.150.50.1 with SMTP id x1mr2433678ybx.7.1246892782555;
Mon, 06 Jul 2009 08:06:22 -0700 (PDT)
Return-Path: <gary.richard...@gmail.com>
Received: from mail-yx0-f174.google.com (mail-yx0-f174.google.com [209.85.210.174])
by gmr-mx.google.com with ESMTP id 15si1213463gxk.0.2009.07.06.08.06.21;
Mon, 06 Jul 2009 08:06:21 -0700 (PDT)
Received-SPF: pass (google.com: domain of gary.richard...@gmail.com designates 209.85.210.174 as permitted sender) client-ip=209.85.210.174;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of gary.richard...@gmail.com designates 209.85.210.174 as permitted sender) smtp.mail=gary.richard...@gmail.com; dkim=pass (test mode) header...@gmail.com
Received: by mail-yx0-f174.google.com with SMTP id 4so4042786yxe.27
for <capistrano@googlegroups.com>; Mon, 06 Jul 2009 08:06:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=gamma;
h=domainkey-signature:mime-version:received:in-reply-to:references
:date:message-id:subject:from:to:content-type;
bh=HplSFIDVOVi4tNMkbZx36oiAJlrk/MYAsRehNE9vrTk=;
b=MBfvD3hNh6qGkfrzyC5pdJ9Nyrs/GK71puCeg7imW85fZa0iYiRftzrKXTnw3i1jny
OsooYvLpvNnMrYa/KN/0VCABWGik/KRfs2TAgV53A1K5tUlSbLzL0tDgRYb4fsix/9WF
QsNV2RetmDlK9ayF2g2JiebYerr6jpR4IuYrs=
DomainKey-Signature: a=rsa-sha1; c=nofws;
d=gmail.com; s=gamma;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
b=RLypkHb/yleB7F4wCd/Y6jtOjVeoOHl9BV03BX74gJ3EnuMdxb9dzo/7dvBNDEEga3
9w3oipsUbxWJyS48I8aejOiFRvkViBZxVDOqic6DddVkVQ2HspMs+JGuFYDYRs80ioEI
hAJs9GOHRDUMkPoYqH9ixUx8hOqO69U6ec23U=
Mime-Version: 1.0
Content-Type: multipart/alternative;
boundary="0016e6409bce4f6127046e0ad980"
Received: by 10.100.154.14 with SMTP id b14mr8646818ane.142.1246892781428;
Mon, 06 Jul 2009 08:06:21 -0700 (PDT)
In-Reply-To: <4A51D275.9000108@aspgems.com>
References: <be2921990907031747g35a66441w15eecfc687165b3b@mail.gmail.com>
<4A51D275.9000...@aspgems.com>
Date: Mon, 6 Jul 2009 08:06:21 -0700
Message-ID: <be2921990907060806o150e0107qeaf20990b3b46...@mail.gmail.com>
Subject: Re: [capistrano] Re: Identify current host
From: Gary Richardson <gary.richard...@gmail.com>
To: capistrano@googlegroups.com
--0016e6409bce4f6127046e0ad980
Content-Type: text/plain; charset=ISO-8859-1
Hmm. That's odd..$CAPISTRANO:HOST$ wasn't working for me on Friday. Must be
them gremlins.
Is there another variable I can use to get the current host in the ruby
code? This is what I'm trying to do:
task :bootstrap, :roles => [:master] do
# instanceids is an array containing hostname => instanceid
id = instanceids["$CAPISTRANO:HOST$"]
run "register_host -H $CAPISTRANO:HOST$ -s #{id}"
end
Obviously, $CAPISTRANO:HOST$ doesn't interpolate on the id = instanceids[]
line.
Thanks!
On Mon, Jul 6, 2009 at 3:31 AM, Rafael G. <r...@aspgems.com> wrote:
>
> Gary Richardson wrote:
> > 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
> I tested this task and works for me:
>
> task :host_name do
> run "host $CAPISTRANO:HOST$"
> end
>
> What OS are you using? Could you paste your deploy.rb in
> someplace(gist.github, pastie,...)?
>
> > 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?
> Capistrano uses ruby If you can do it with ruby you can do the same in a
> capistrano task.
>
> --
> Rafa
>
>
> >
>
--0016e6409bce4f6127046e0ad980
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hmm. That's odd..$CAPISTRANO:HOST$ wasn't working for me on Friday.=
Must be them gremlins.<div><br></div><div>Is there another variable I can =
use to get the current host in the ruby code? This is what I'm trying t=
o do:</div>
<div><br></div><div><div>=A0=A0task :bootstrap, :roles =3D> [:master] do=
</div><div>=A0=A0 =A0 =A0 =A0# instanceids is an array containing hostname =
=3D> instanceid</div><div><span class=3D"Apple-tab-span" style=3D"white-=
space:pre"> </span>id =3D instanceids["$CAPISTRANO:HOST$"]</div>
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>run &=
quot;register_host -H $CAPISTRANO:HOST$ -s #{id}"</div><div>=A0=A0end<=
/div><div><br></div>Obviously,=A0$CAPISTRANO:HOST$=A0doesn't=A0interpol=
ate=A0on the id =3D instanceids[] line.</div>
<div><br></div><div>Thanks!</div><div><br><div class=3D"gmail_quote">On Mon=
, Jul 6, 2009 at 3:31 AM, Rafael G. <span dir=3D"ltr"><<a href=3D"mailto=
:r...@aspgems.com">r...@aspgems.com</a>></span> wrote:<br><blockquote clas=
s=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pad=
ding-left:1ex;">
<div class=3D"im"><br>
Gary Richardson wrote:<br>
> Hey,<br>
><br>
> Two part question that I haven't been able to answer:<br>
><br>
> 1) can I get the current host a task is executing on? I've read so=
me<br>
> stuff about $CAPISTRANO:HOST$, but it doesn't seem to work for me<=
br>
</div>I tested this task and works for me:<br>
<br>
=A0 =A0task :host_name do<br>
=A0 =A0 =A0 =A0run "host $CAPISTRANO:HOST$"<br>
=A0 =A0end<br>
<br>
What OS are you using? Could you paste your deploy.rb in<br>
someplace(gist.github, pastie,...)?<br>
<div class=3D"im"><br>
> 2) if I have an array of values (let's say an array that maps ec2 =
host<br>
> names to ec2 instance id's), can I use this same method to look up=
<br>
> something from that array?<br>
</div>Capistrano uses ruby If you can do it with ruby you can do the same i=
n a<br>
capistrano task.<br>
<br>
--<br>
Rafa<br>
<br>
<br>
<br>
</blockquote></div><br></div>
--0016e6409bce4f6127046e0ad980--