summaryrefslogtreecommitdiff
path: root/tools/certtools.py
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2015-07-31 23:31:24 +0200
committerMagnus Ahltorp <map@kth.se>2015-07-31 23:31:24 +0200
commitfae6b9c78099fa40bcbf9ed451979cdca715fef0 (patch)
treeca1fb20fc73aabb41c441074f80c52bb8f4f9930 /tools/certtools.py
parent6d028f7f9d596dc4d7011a9c6e427379d4f59c49 (diff)
Added storage gc scriptstoragegc
Diffstat (limited to 'tools/certtools.py')
-rw-r--r--tools/certtools.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/certtools.py b/tools/certtools.py
index ed8ab30..dfd5b24 100644
--- a/tools/certtools.py
+++ b/tools/certtools.py
@@ -15,6 +15,7 @@ import ecdsa
import datetime
import cStringIO
import zipfile
+import shutil
from certkeys import publickeys
def get_cert_info(s):
@@ -734,3 +735,11 @@ def extract_original_entry(entry):
leaf_cert = precert
certchain = decode_certificate_chain(extra_data)
return ([leaf_cert] + certchain, timestamp, issuer_key_hash)
+
+def mv_file(fromfn, tofn):
+ shutil.move(fromfn, tofn)
+
+def write_file(fn, sth):
+ tempname = fn + ".new"
+ open(tempname, 'w').write(json.dumps(sth))
+ mv_file(tempname, fn)