Created
December 13, 2013 18:34
-
-
Save kaithar/7948949 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from salt.client import LocalClient | |
client = LocalClient() | |
o = client.cmd(t, 'cmd.run_all', kwarg={ | |
'cmd': 'curl *options and url redacted*', | |
'cwd': dirname | |
}) | |
print "Ret: %(retcode)d\n\nstdout:\n%(stdout)s\n\nstderr:\n%(stderr)s\n" % o[t] | |
print o[t], "\n" | |
if o[t]['retcode'] != 0: | |
client.cmd(t, 'file.remove', arg=(dirname,), timeout=5) | |
else: | |
o = client.cmd(t, 'cmd.run_all', kwarg={ 'cmd': sed_monster, 'cwd': dirname}) | |
if o[t]['retcode'] != 0: | |
client.cmd(t, 'file.remove', arg=(dirname,), timeout=5) | |
else: | |
print client.cmd(t, 'cmd.run_all', kwarg={ | |
'cmd': 'mv %s %s' % (dirname, realdirname)}, | |
timeout=5) | |
#--- | |
from salt.client import LocalClient | |
from salt.key import Key | |
client = LocalClient() | |
keys = Key(client.opts) | |
grains = client.cmd("*", "grains.items", timeout=1) | |
army = [] | |
for node in keys.all_keys()['minions']: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment