Mathieu,

This has been applied. I apologize for not getting it in before  
releasing 1.4.0--I'll collect a few more patches and do 1.4.1 in a  
week or so.

- Jamis

On Jan 24, 2007, at 1:02 PM, Mathieu Lajugie wrote:

>
> Great! I have posted the patch (against version 1.3.1), it is
> available at http://dev.rubyonrails.org/ticket/7223
>
> It adds the environment in the Command initialization, so it works
> for all commands.
>
> Let me know if you would like any change to the patch. I have not
> created any test for instance, but I could do that if you wish.
>
> --mathieul
>
>
> On Jan 24, 2007, at 10:55 AM, Jamis Buck wrote:
>
>>
>> Mathieu,
>>
>> I'm all for user patches, seriously. And your suggestion looks very
>> nice. Please do send in a patch for that. Could you also make it so
>> that the run command accepts the same :env hash? That way both work
>> the same and expectations aren't broken. Thanks!
>>
>> - Jamis
>>
>> On Jan 24, 2007, at 8:42 AM, Mathieu Lajugie wrote:
>>
>>> The small patch I made allows to pass a hash of variables that are
>>> escaped and set in the run command. So it works for run/sudo/
>>> stream. For instance:
>>>
>>> task :my_test, :roles => :scripting do
>>>   sudo "env", :env => {'PATH' => '/foo/bar'}
>>> end
>>>
>>> Would it make sense for you to include the feature in Capistrano?
>>> What is your policy with including user patches?
>>>
>>> Thanks,
>>>
>>> --mathieul
>>>
>>>
>>> On Jan 23, 2007, at 3:29 PM, Jamis Buck wrote:
>>>
>>>>
>>>> Environment variables can be set as you described when using "run".
>>>> Unfortunately, it's trickier when using sudo. :( For now, the
>>>> easiest
>>>> way to do it with sudo is to create a shell script that sets the
>>>> environment and runs the commands, and invoke that script via sudo.
>>>>
>>>> You can always do:
>>>>
>>>>    run "PATH=/foo/bar sudo env"
>>>>
>>>> but the problem with that approach is that Capistrano doesn't know
>>>> you're running sudo, and so won't know to prompt for a password and
>>>> such. :(
>>>>
>>>> - Jamis
>>>>
>>>> On Jan 23, 2007, at 3:55 PM, Mathieu Lajugie wrote:
>>>>
>>>>>
>>>>> It works great, thanks!
>>>>>
>>>>> I guess I should have looked at the changelog first...
>>>>>
>>>>> Is there also a way to set environment variables before running a
>>>>> command, like PATH? It is ok to do:
>>>>>
>>>>> run "PATH=/my/path/to/bin:$PATH env | grep PATH"
>>>>>
>>>>> But doing the same with sudo fails because:
>>>>>
>>>>> sudo "PATH=/my/path/to/bin:$PATH env | grep PATH"
>>>>>
>>>>> executes:
>>>>>
>>>>> run "sudo PATH=/my/path/to/bin:$PATH env | grep PATH"
>>>>>
>>>>> when it actually should execute:
>>>>> run "PATH=/my/path/to/bin:$PATH sudo env | grep PATH"
>>>>>
>>>>> Thanks again for Capistrano, your blog and Rails!
>>>>>
>>>>>
>>>>> --mathieul
>>>>>
>>>>>
>>>>> On Jan 23, 2007, at 12:24 PM, Jamis Buck wrote:
>>>>>
>>>>>>
>>>>>> mathieul,
>>>>>>
>>>>>> You can actually do this:
>>>>>>
>>>>>>    task :my_test, :hosts => "linux7" do
>>>>>>      ...
>>>>>>    end
>>>>>>
>>>>>> That will then execute that task _specifically_ and _only_ on the
>>>>>> linux7 host. Does that work for you?
>>>>>>
>>>>>> - Jamis
>>>>>>
>>>>>> On Jan 23, 2007, at 12:18 PM, mathieul wrote:
>>>>>>
>>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I'm pretty new to using Capistrano (but pretty addicted already)
>>>>>>> so I
>>>>>>> apologize in advance if this topic has been answered many times
>>>>>>> already.
>>>>>>>
>>>>>>> I am trying to get our company to start using Ruby. One of the
>>>>>>> components I am trying to replace is cfengine. I think that
>>>>>>> Capistrano
>>>>>>> would be much more powerful, simple and easy to maintain (we are
>>>>>>> only
>>>>>>> using cfengine for deploying our application).
>>>>>>>
>>>>>>> One of the typical tasks we do is to check if one of our
>>>>>>> package is
>>>>>>> installed (a rpm for instance), and if yes what  is its version.
>>>>>>> Based
>>>>>>> on the result, we will or not upload the RPM and install/update
>>>>>>> it. We
>>>>>>> don't want to do it no matter what, there can be a lot of
>>>>>>> packages to
>>>>>>> potentially install on 20 servers.
>>>>>>>
>>>>>>>> From what I understand of Capistrano philosophy, a command
>>>>>>>> can be
>>>>>>> executed on a list of servers determined by their roles and
>>>>>>> optionally
>>>>>>> additional attributes. I didn't find a way to limit a
>>>>>>> run/stream/sudo/put/delete command to a list of servers built at
>>>>>>> runtime.
>>>>>>>
>>>>>>> So I have written a patch (http://dev.rubyonrails.org/ticket/
>>>>>>> 7223:
>>>>>>> Allow to set environment variables and limit the list of servers
>>>>>>> when
>>>>>>> running a remote command) to do just that (it also allow to set
>>>>>>> environment variables). Is there an easier built-in way to do
>>>>>>> that? If
>>>>>>> not, do you think it is the right way to implement it?
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> --mathieul
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>>
>>
>>
>>>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
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