Ah, I had not read the doc on library usage yet. That makes more sense then.

Thanks for the help!


On May 5, 2011, at 10:11, Jeff Forcier <j...@bitprophet.org> wrote:

> Hi Corry,
>
> For background, see the execution docs here:
>
>    http://docs.fabfile.org/en/1.0.1/usage/execution.html
>
> and the "library" usage docs here:
>
>    http://docs.fabfile.org/en/1.0.1/usage/library.html
>
> The gist is that the decorators are only detected by the 'fab' tool
> and thus only apply to tasks specified on the command line. Calls to
> subtasks are just plain old Python function calls and don't do any
> magic regarding the current connection host.
>
> As mentioned in the library usage docs, you can work around this by
> updating env.host_string (typically via "with settings():") when
> calling your subtasks.
>
> This will become less of a hassle in future versions.
>
> Thanks,
> Jeff
>
> On Thu, May 5, 2011 at 9:30 AM, Corry Haines <tabletco...@gmail.com> wrote:
>> After trying out a few (failed) iterations, it seems that I should ask the
>> mailing list if this is even possible.
>> In short, I would like to have functions call other functions, and when the
>> new function starts, it is applied to distinct roles. An example follows:
>> @roles("a")
>> def entry_function():
>>     # Run some code specific to role a
>>     second_function()
>>     # More role a specific code
>> @roles("b")
>> def second_function():
>>     # Run some code specific to role b
>> When I try this, it seems that there is a "First Wins" behavior, and role
>> "a" is used for second_function. This happens regardless of the roles
>> specified on the command line.
>> Is it possible for the command line to specify a list of roles, and have
>> some of the internal functions operate on a distinct set of roles? A use
>> case is a deployment function (the entry function) that needs to update the
>> RPM repo before running anything else.
>> Thanks,
>> Corry
>> _______________________________________________
>> Fab-user mailing list
>> Fab-user@nongnu.org
>> https://lists.nongnu.org/mailman/listinfo/fab-user
>>
>>
>
>
>
> --
> Jeff Forcier
> Unix sysadmin; Python/Ruby engineer
> http://bitprophet.org

_______________________________________________
Fab-user mailing list
Fab-user@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to