diff options
author | Linus Nordberg <linus@nordu.net> | 2015-06-05 12:11:09 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2015-06-05 12:11:09 +0200 |
commit | 5ed094822b28eb1ca871864e49f63f23d4a6cf68 (patch) | |
tree | 4ff2e50c67848e98250bce7587c1fd0d61b8dde6 /mklog.py | |
parent | 228aae4427925c7f62f19b96ea009f448fd68b97 (diff) |
Don't recreate authkeys.
Diffstat (limited to 'mklog.py')
-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 |