[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fab-user] Proposal: remote execution of Python code
From: |
Richard Jones |
Subject: |
Re: [Fab-user] Proposal: remote execution of Python code |
Date: |
Mon, 16 Feb 2009 10:34:51 +1100 |
User-agent: |
KMail/1.9.10 |
On Sun, 15 Feb 2009 11:13:23 am you wrote:
> On Sat, Feb 14, 2009 at 6:59 PM, Richard Jones <address@hidden> 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