fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] setup task


From: Christian Vest Hansen
Subject: Re: [Fab-user] setup task
Date: Thu, 30 Oct 2008 10:34:55 +0100

On Tue, Oct 28, 2008 at 6:15 AM, Byron Saltysiak <address@hidden> wrote:
> I'm trying to set fab_hosts and other vars based on arguments passed into
> fab such as:
> fab set:env=prod restart
>
> but this is not working because of the sort of chicken vs egg problem with
> fab_hosts so instead I can do this and it will work:
> fab set:env=prod restartSetup restart
>
> in which the restartSetup does the actual setting of fab_hosts and anything
> else the command would need
>
> Is there a way to specify a setup for "restart" in this situation without
> having someone have to always type in two commands?

In Fabric 0.0.9, you can have a call to restartSetup() as the first
thing in your restart command.


In the current master will allow you to do something like this:

def setup():
    if config.env == "test": config.fab_hosts = ["testy"]
    elif config.env == "prod": config.fab_hosts = ["proddy"]

@depends(setup)
def restart():
   print config.fab_hosts

>
>
> Also note that I'll have different commands and each would have it's own
> setup since they might take different parameters and do different things.
> For instance the setup for a deploy task would need a version and might
> download the a war from an internal repository somewhere. (ex:  fab
> set:env=prod set:version=1.2.3 setupDeploy deploy)
>
>
> --
> Byron
>
> _______________________________________________
> Fab-user mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/fab-user
>
>



-- 
Venlig hilsen / Kind regards,
Christian Vest Hansen.




reply via email to

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