fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] Can I pass in information from the command-line to my fu


From: Matthew Wilson
Subject: Re: [Fab-user] Can I pass in information from the command-line to my functions?
Date: Tue, 18 Aug 2009 14:58:31 -0400

Yeah, after I sent this email, I found the command-line behavior page,
and discovered that fabric does what I need.

On Tue, Aug 18, 2009 at 2:56 PM, Jeff Forcier<address@hidden> wrote:
> If I read you right this is another "I really need to get my docstrings more
> visible in the prose docs" issue that should be solved by my upcoming doc
> sprint. You seem to be wanting task arguments:
> http://docs.fabfile.org/0.9/api/main.html#fabric.main.parse_arguments
>
> For example:
>
>    from fabric.api import run
>
>    def upgrade_webapp(revision):
>        run('git checkout -b %s origin/%s' % (revision, revision))
>
> Executed as:
>
>    $ fab upgrade_webapp:rev14
>
> or:
>
>    $ fab upgrade_webapp:revision=rev14
>
>
> -Jeff
>
>
> On Tue, Aug 18, 2009 at 2:47 PM, Matthew Wilson<address@hidden> wrote:
>> Right now, when I upgrade my production box to the next version of my
>> web app, I run a set of commands manually.
>>
>> I'm working on converting all this to using fabric.
>>
>> Here's the commands I run to upgrade my web app from revision 13 to revision 
>> 14:
>>
>> $ sudo supervisorctl stop all # this shuts down a bunch of scripts and
>> my web server.
>> $ cd ~/projects/webapp
>> $ git fetch origin
>> $ git checkout -b rev14 origin/rev14
>> $ sudo supervisorctl start all
>>
>>
>> When I upgrade from rev14 to rev15, it's going to be roughly the same
>> steps, but I'll be checking out rev15 instead.
>>
>> I want to run fabric sort of like this:
>>
>> $ fab upgrade_webapp --revision rev14
>>
>> And then in my upgrade_webapp function, somehow use that revision
>> rev14 as a dictionary that I can interpolated into my strings.
>>
>> Is this possible?
>>
>> How are other people solving problems where the functions are
>> effectively identical except for parameters?
>>
>> Matt
>>
>>
>>
>> --
>> Matthew Wilson
>> address@hidden
>> http://tplus1.com
>>
>>
>> _______________________________________________
>> Fab-user mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/fab-user
>>
>



-- 
Matthew Wilson
address@hidden
http://tplus1.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]