|
From: | Lamont Nelson |
Subject: | Re: [Fab-user] fabric2 cd with multiple servers |
Date: | Fri, 13 Oct 2017 02:51:55 -0400 |
Lamont,It's honestly been a while since I used fabric and have not really stayed up on it so apologies if my research was too hastily done and incorrect. There does seem to be the functionality you are looking for in both fabric 1 and 2 (alpha) though they have some slight differences.In fabric 1.x it came from here: https://github.com/fabric/fabric/blob/1.14/ like this: https://github.com/fabric/context_managers.py fabric/fabric/blob/1.14/ fabric/context_managers.py# L20-L21 In fabric 2.x they broke out that into the invoke library here: https://github.com/pyinvoke/invoke/blob/master/ like this: https://github.com/invoke/context.py pyinvoke/invoke/blob/master/ invoke/context.py#L328-L329 Hope this helps,On Tue, Oct 10, 2017 at 7:05 PM, Lamont Nelson <address@hidden> wrote:______________________________I'm learning the fabric2 api and wanted to know the best way to run a command with a particular working directory on a set of servers.The README indicates that there is a 'execute' method on Group, but this doesn't seem to be the case. I was able to get code below to work by calling run on each connection in the group. Is there a more succinct way to do this besides the "cd foo && cmd" method? Or am I overlooking something?-----from fabric import ThreadingGroupg=ThreadingGroup('host1','host2') g.run('cd /tmp && ls foo')-- or --from fabric import ThreadingGroupg=ThreadingGroup('host1','host2') for c in g:with c.cd('/tmp'):c.run('ls foo')-----Regards,Lamont_________________
Fab-user mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/fab-user
--Ben Abrams
[Prev in Thread] | Current Thread | [Next in Thread] |