I solved it like so:
#-------------
from fabric.api import *
env.user = call("whoami")
# assign CLI -H args to role 'current'
env.roledefs ={
'current': env.hosts
}
# clear env.hosts so commands default to localhost
env.hosts = ''
# function to run on remote servers
def testit():
run('hostname')
# function to run once, locally
def runlocal():
local('touch "`date`"')
def bigtest():
execute(testit, role='current')
runlocal()
--
fab -H server1,server2,server3 bigtest
...runs 'testit' on each server listed on the commandline, yet only runs
'runlocal' once, last.
On Wed, Aug 7, 2013 at 2:10 PM, Kyle Reynolds <[email protected]>wrote:
> I am using fabric to pull configuration files to a local directory, and
> then once I have all of the files local, I want to run an md5 checksum to
> check consistency. The problem I'm having is figuring out how to run the
> final function, only ONCE, locally, AFTER all of the files have been pulled
> down by another function.
>
> I have looked into the @run_once decorator, but I need this function to
> run *after *everything, not once on the first run.
>
> any ideas or suggestions?
>
> Thanks!
>
>
>
--
Sent via International Space Station by way of my Top Secret decoder ring
--
Kyle Reynolds
--------------------------------------------------------------
http://www.mythictechnologies.com
--------------------------------------------------------------
[email protected]
--------------------------------------------------------------
Follow me on Twitter!
https://twitter.com/kyle_reynolds<https://twitter.com/#!/kyle_reynolds>
_______________________________________________
Fab-user mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/fab-user