Fix concurrent SSH key file creation.

Change-Id: Ie55953bab99dcd8544c3406ba93df604382f8721
This commit is contained in:
Federico Ressi 2019-07-26 10:33:01 +02:00
parent 8f54245d04
commit a3b65cb335
1 changed files with 7 additions and 5 deletions

View File

@ -56,11 +56,13 @@ class KeyPairStackFixture(heat.HeatStackFixture):
if not os.path.isdir(key_dir):
os.makedirs(key_dir)
assert os.path.isdir(key_dir)
command = sh.shell_command(['ssh-keygen',
'-f', key_file,
'-P', ''])
sh.local_execute(command)
assert os.path.isfile(key_file)
try:
sh.local_execute(['ssh-keygen', '-f', key_file, '-P', ''])
except sh.ShellCommandFailed:
if not os.path.isfile(key_file):
raise
else:
assert os.path.isfile(key_file)
class FlavorStackFixture(heat.HeatStackFixture):