summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmklog.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/mklog.py b/mklog.py
index f8f3510..8c7f89a 100755
--- a/mklog.py
+++ b/mklog.py
@@ -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