[Fab-user] How do I handle when something goes wrong

2009-07-07 Thread Matthew Wilson
I'm going to use fabric to tell my remote webservers to pull down some updated code and then restart. If the code pull fails, I don't want to restart. Instead I want to know about it so I can figure out what went wrong. Is there anything in fabric to let me catch status codes from scripts, or

Fwd: [Fab-user] How do I handle when something goes wrong

2009-07-07 Thread Jeff Forcier
Check out the docs for sudo and run:    http://docs.fabfile.org/0.9/api/operations.html You'll see mention of a failed attribute, so you can do stuff like:    def foo():        result = run('whatever')        if result.failed:            abort(ohnoes!) Best, Jeff On Tue, Jul 7, 2009 at 2:25

Re: [Fab-user] @hosts decorator fails in python interactive session?

2009-07-07 Thread Jeff Forcier
Yea, sorry, I did see Mike has a fork with a change along these lines, I haven't had time to go over it yet which is why it wasn't on my mind :) With regards to the execution internals, I expect they'll change a lot over time as we need to make stuff more flexible like in this case, and when we

Re: [Fab-user] Maybe my fabfile callables should get called with a parameter

2009-07-07 Thread Jeff Forcier
Check out the value of env.host. It's updated dynamically to be the current host every time. No need to pass anything in, you just need to make sure you import the 'env' object from fabric.api (it's included if you do 'from fabric.api import *', PEP8 compliance notwithstanding.) Better yet, do

[Fab-user] default global domain but not host?

2009-07-07 Thread Jorge Vargas
Hi guys, I have been thinking of this and I'll like your opinion. most (if not all) of the time you will be handling several environments for the same project which normally contain the same domain. The classical example will be test.example.com prod1.example.com prod2.example.com

[Fab-user] Generic prefix context manager?

2009-07-07 Thread Matthew Wilson
Since I use a virtualenv on my servers, before I run python zzz.py, I need to activate the virtualenv. So I'm doing this right now: run(source /home/matt/virtualenvs/foo/bin/activate python zzz.py) I read through how fabric.context_managers.cd works. It seems to set a key in the env

Re: [Fab-user] Generic prefix context manager?

2009-07-07 Thread Matthew Wilson
On Tue, Jul 7, 2009 at 6:33 PM, Jeff Forcierj...@bitprophet.org wrote: Hi Matt, This is definitely on the TODO: make a generic prefix context manager (and then rework 'cd' to use that) which is capable of prefixing any arbitrary string. It'll be in for 1.0 for sure, and probably enter master

Re: [Fab-user] Generic prefix context manager?

2009-07-07 Thread Jorge Vargas
On Tue, Jul 7, 2009 at 5:37 PM, Matthew Wilsonm...@tplus1.com wrote: Since I use a virtualenv on my servers, before I run python zzz.py, I need to activate the virtualenv.  So I'm doing this right now:    run(source /home/matt/virtualenvs/foo/bin/activate python zzz.py) I read through how