Prevent mkdir failure due to race condition

When `hostlist` contains significant amount of servers, race conditions start to occur - multiple threads check `if not os.path.exists(opts['log_dir'])` and try to `os.makedirs(opts['log_dir'])`, and those threads that got that path does not exist but lose the race end up crashing, files don't get uploaded to those hosts. This fix is probably not the most elegant one, but it deals with those race condtions.