Sorry, I thought I already replied with this update, but the -H switch definitely works from the command-line if you don't define env.hosts in the fabfile. It's working just as expected now. Thanks!
~Ryan On Fri, Jul 13, 2012 at 8:26 AM, Morgan Goose <[email protected]>wrote: > @Ryan, so can you give us some context? Your question would be quicker > to answer is you, showed what you have (simplest code snippet), what > it's doing (output from the run), and what you expected. > > -goose > > On Thu, Jul 12, 2012 at 2:00 PM, Brown, Rodrick <[email protected]> wrote: > > My response was to the OP was asking how to load a dynamic list of hosts > > into fabric. > > > > The no magic solution is to treat Fab scripts like Python scripts, > env.hosts > > is just looking for a list so you can easily populate env.hosts with > normal > > python code that reads data from a file and stores the result set in a > list. > > > > > > > > From: Ryan Bales [mailto:[email protected]] > > Sent: Thursday, July 12, 2012 4:37 PM > > To: Brown, Rodrick > > Cc: fab-user > > Subject: Re: [Fab-user] Dynamic hosts not supported by -H? > > > > > > > > Well there _is_ some magic to it, though, isn't there? Fabric handles > > execution as specified on the command-line, executing the right methods > for > > the right hosts and such. That's why you call fab, and not python, > right? > > > > > > > > ~R > > > > > > > > On Thu, Jul 12, 2012 at 3:15 PM, Brown, Rodrick <[email protected]> > wrote: > > > > Fabric is just python there is no magic to it. > > > > > > > > $ cat >fabfile1.py > > > > import fabric > > > > from fabric.api import run, env > > > > import os > > > > > > > > hostlist = '/tmp/hostlist' > > > > if (os.path.exists(hostlist)): > > > > env.hosts = list(file(hostlist).readlines())[:-1] > > > > print(env.hosts) > > > > > > > > def checkproc(): > > > > run('/bin/ps -elf |grep java') > > > > > > > > $ fab checkproc -f fabfile1.py > > > > > > > > From: [email protected] > > [mailto:[email protected]] On Behalf Of Ryan > > Bales > > Sent: Thursday, July 12, 2012 9:27 AM > > To: fab-user > > Subject: [Fab-user] Dynamic hosts not supported by -H? > > > > > > > > Hello all, > > > > > > > > I'm trying to build a web app around a few fabric scripts, and I need to > > supply a dynamic list of hosts to the scripts. I saw the -H switch, but > it > > apparently only works when env.hosts is defined in the fabric script. I > > also looked at command-line kwargs for methods, but the methods won't > even > > be executed without env.hosts being defined. Can someone point me in the > > right direction? > > > > > > > > Thanks, > > -- > > Ryan Bales > > http://thinkt4nk.com/ > > http://twitter.com/#!/thinkt4nk > > https://github.com/thinkt4nk > > > > > > > > > > > > -- > > Ryan Bales > > http://thinkt4nk.com/ > > http://twitter.com/#!/thinkt4nk > > https://github.com/thinkt4nk > > > > > > Please visit our website for important disclaimers/disclosures regarding > > Knight’s products and services: > > > > http://www.knight.com/KnightEmailDisclaimer.html > > > > > > > > > > > > -- > > Ryan Bales > > http://thinkt4nk.com/ > > http://twitter.com/#!/thinkt4nk > > https://github.com/thinkt4nk > > > > > > Please visit our website for important disclaimers/disclosures regarding > > Knight’s products and services: > > > > http://www.knight.com/KnightEmailDisclaimer.html > > > > > > _______________________________________________ > > Fab-user mailing list > > [email protected] > > https://lists.nongnu.org/mailman/listinfo/fab-user > > > -- Ryan Bales http://thinkt4nk.com/ http://twitter.com/#!/thinkt4nk https://github.com/thinkt4nk
_______________________________________________ Fab-user mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/fab-user
