diff options
-rwxr-xr-x | mklog.py | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -114,17 +114,20 @@ def make_authkeys(nodenames): os.mkdir(wdir) os.chdir(wdir) + priv_dst = '../nodes/%s/%s-private.pem' % (nodename, nodename) + pub_dst = '../nodes/%s/publickeys' % nodename + for nodename in nodenames: + if os.access(priv_dst, os.R_OK): + continue if not make_eckey(nodename): return False - dst = '../nodes/%s/%s-private.pem' % (nodename, nodename) - if os.access(dst, os.F_OK) and not os.access(dst, os.W_OK): - os.chmod(dst, stat.S_IWUSR) - shutil.move('%s-private.pem' % nodename, dst) + if os.access(priv_dst, os.F_OK) and not os.access(priv_dst, os.W_OK): + os.chmod(priv_dst, stat.S_IWUSR) + shutil.move('%s-private.pem' % nodename, priv_dst) for nodename in nodenames: - dst = '../nodes/%s/publickeys' % nodename - shutil.rmtree(dst, ignore_errors=True) - shutil.copytree('.', dst) + shutil.rmtree(pub_dst, ignore_errors=True) + shutil.copytree('.', pub_dst) os.chdir('..') return True |