From 5ed094822b28eb1ca871864e49f63f23d4a6cf68 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Fri, 5 Jun 2015 12:11:09 +0200 Subject: Don't recreate authkeys. --- mklog.py | 17 ++++++++++------- 1 file 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 -- cgit v1.1