Skip to content
This repository was archived by the owner on Dec 10, 2017. It is now read-only.

Commit

Permalink
moved log_dir creation to main thread
Browse files Browse the repository at this point in the history
Prevents race condition #19
  • Loading branch information
tomas-didziokas committed Sep 24, 2014
1 parent 82af933 commit bbaee04
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions herd/herd.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,6 @@ def transfer(host, local_file, remote_target, retry=0):


def ssh(host, command):
if not os.path.exists(opts['log_dir']):
os.makedirs(opts['log_dir'])

with open("%s%s%s-ssh.log" % (opts['log_dir'], os.path.sep, host),
'a') as log:
result = subprocess.call([
Expand Down Expand Up @@ -221,6 +218,8 @@ def local_ip():


def herdmain():
if not os.path.exists(opts['log_dir']):
os.makedirs(opts['log_dir'])
if not os.path.exists(opts['hosts']) and opts['hostlist'] is False:
hosts = [line.strip() for line in sys.stdin]
elif opts['hosts']:
Expand Down

0 comments on commit bbaee04

Please sign in to comment.