added: launch_ssh: fake execution of commands

This commit is contained in:
adobdin 2016-02-19 13:26:10 +00:00
parent 3adc1f569d
commit 87d9c1487a

View File

@ -127,6 +127,7 @@ class Node(object):
(self.node_id, self.ip, os.path.basename(f))) (self.node_id, self.ip, os.path.basename(f)))
logging.info('outfile: %s' % dfile) logging.info('outfile: %s' % dfile)
self.mapcmds[os.path.basename(f)] = dfile self.mapcmds[os.path.basename(f)] = dfile
if not fake:
try: try:
with open(dfile, 'w') as df: with open(dfile, 'w') as df:
df.write(outs) df.write(outs)
@ -367,7 +368,7 @@ class Nodes(object):
for node in self.nodes.values(): for node in self.nodes.values():
logging.debug('%s' % node.files[ckey]) logging.debug('%s' % node.files[ckey])
def launch_ssh(self, odir='info', timeout=15): def launch_ssh(self, odir='info', timeout=15, fake=false):
lock = flock.FLock('/tmp/timmy-cmds.lock') lock = flock.FLock('/tmp/timmy-cmds.lock')
if not lock.lock(): if not lock.lock():
logging.warning('Unable to obtain lock, skipping "cmds"-part') logging.warning('Unable to obtain lock, skipping "cmds"-part')
@ -384,7 +385,8 @@ class Nodes(object):
self.sshvars, self.sshvars,
self.sshopts, self.sshopts,
odir, odir,
self.timeout,)) self.timeout,
fake))
threads.append(t) threads.append(t)
t.start() t.start()
for t in threads: for t in threads: