Re: [Fab-user] Connecting to a remote host through an ssh gateway
David Anderson dixit: Host prod.example.com ProxyCommand ssh gate.example.com nc -w 1 prod.example.com 22 Hi David, There's how I deal with this: # # .ssh/config Host gate.tunnel Hostname gate.example.com LocalForward 2000 prod.example.com:22 Host prod.tunnel Hostname 127.0.0.1 Port 2000 # I create a tunnel that closes after 30 seconds or when the tunneled connexion finishes: $ ssh gate.tunnel -f sleep 30 And now you can launch Fabric commands or plain SSH commands: $ scp /this/file prod.tunnel:/tmp The great problem with this approach is I must maintain several SSH configurations for every host, depending on where I am connecting from. And I must reconfigure 'fab_hosts' for the same reason, too. I really like Fabric and try to find workarounds for the Paramiko limitations, but not having a real SSH but just a seriously limited subset of the tool is, sincerely, a pain. I understand that I'm not the most typical Fabric user because I'm not a developer but a sysadmin, and many times my needs doesn't fit into the deploy- restart-or-rollback schema. But I think supporting the full SSH set of commands could be really beneficial for many Fabric users. Would it be possible to wrap the 'ssh' command as backend instead of Paramiko? I haven't yet taken a loot at how Fabric does this, but looks like PuSSH [1] is using this approach. [1] http://pypi.python.org/pypi/PuSSH/ Please take this as a suggestion for improvement, not as criticism. I like Fabric and it's solving many needs for me ;-) even with the Paramiko limitations. And, what's more important, I enjoy using it. -- ## ### Jordi Funollet ### http://www.terraquis.net ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
Re: [Fab-user] Output of local()
Christian Vest Hansen dixit: (I actually don't really use capturing) For me it's a major feature: tools like Fabric are really useful for collecting information sparsed around many hosts. -- ## ### Jordi Funollet ### http://www.terraquis.net ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
Re: [Fab-user] Proposal: remote execution of Python code
On Sun, 15 Feb 2009 11:13:23 am you wrote: On Sat, Feb 14, 2009 at 6:59 PM, Richard Jones rjo...@ekit-inc.com wrote: Actually, no, it's for remote system deployment where we need to perform operations on the remote end that currently require us to copy a script to that system and execute it (which is your proposed workaround). Can you give a concrete example, then? I can't think of anything offhand that Fabric cannot currently do along those lines; it can execute any remote shell command (normally and via sudo), local shell commands, put/get files, and is capable of obtaining the output of the remote commands and performing logic based on those results. Yes, you're pretty much just repeating what I referred to as your proposed workaround :) I'd like to be able to do stuff like: Debug(WARN, STOPPING SERVER: %s:%s%(ihost, ihome)) killcmds = [] try: z2pids = open('%s/var/ZEO_SERVER-starting.pid'%ihome).read() except: try: z2pids = open('%s/var/ZEO_SERVER.pid'%ihome).read() except: Debug(INFO, no pid file - not running?) z2pids = None if z2pids: z2pids = z2pids.split() z2pids = filter(lambda x:x!='1', z2pids) # don't kill init :) z2pids = ' '.join(z2pids) killcmds.append('-kill -TERM %s 2/dev/null'%z2pids) if killcmds: do_commands('stop_server', ihost, killcmds) without having to write that as a script on the remote end. Currently we do it that way, and it just feels inelegant :) I think I can comfortably say the developer response to my proposal is a solid YAGNI, so I'll move on :) Richard ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
Re: [Fab-user] Proposal: remote execution of Python code
On Sun, Feb 15, 2009 at 6:34 PM, Richard Jones rjo...@ekit-inc.com wrote: I'd like to be able to do stuff like: open('%s/var/ZEO_SERVER-starting.pid'%ihome).read() do_commands('stop_server', ihost, killcmds) As far as I can tell, those were the only two kinds of method calls you had in the script that actually affect anything outside the script, and thus the only things that could possibly require remote execution. 'open()' could turn into two lines, download() + open() (and I could definitely see an argument for making a convenience method encapsulating the two); or, if one didn't need the file interface, it can already be done in a one-liner, z2pids = run('cat /location/of/zeo_pid_file') -- as run() returns its output, and I assume you know what the cat command does! I don't know what do_commands() does; does it simply execute a local shell command? Guessing not since you'd obviously know to turn that into a run() or sudo(); so is it a method you had to import from some other Python on that remote system? Which would explain your insistence that Fabric isn't cutting it right now...:) Please let me know -- I want to make sure I understand your needs here, even if I do have to end up saying nope, not happening anytime soon. Best, Jeff ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
[Fab-user] global name 'config' is not defined am I doing something dumb?
I have a file named fabfile.py and was literally just testing out basic functionality using 0.0.9 and the user guide. def staging(): config.fab_hosts = ['my.staging.host.com'] def hello_remote(): prints hello on the remote hosts run(echo hello from $(fab_host) to $(fab_user)) I get config.fab_hosts = ['my.staging.host.com'] NameError: global name 'config' is not defined when I run fab staging hello_remote am I missing something really trivial? All the sample files on git don't seem to have anything special defined for config before using it. Thanks. Mike. ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
Re: [Fab-user] global name 'config' is not defined am I doing something dumb?
This got me a couple days ago. The documentation online is actually for the development head in git. The documentation you want is available from http://github.com/karmazilla/fabric/tree/0.0.9. Look inside the doc folder. Alternately, you could just install the development head. They added a hosts decorator that makes working with different sets of servers in the same script much easier (possible). HTH, Alex On Sun, Feb 15, 2009 at 9:27 PM, Mike Panchenko m...@mihasya.com wrote: I have a file named fabfile.py and was literally just testing out basic functionality using 0.0.9 and the user guide. def staging(): config.fab_hosts = ['my.staging.host.com'] def hello_remote(): prints hello on the remote hosts run(echo hello from $(fab_host) to $(fab_user)) I get config.fab_hosts = ['my.staging.host.com'] NameError: global name 'config' is not defined when I run fab staging hello_remote am I missing something really trivial? All the sample files on git don't seem to have anything special defined for config before using it. Thanks. Mike. ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user