aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thompson <daniel.thompson@linaro.org>2019-01-15 16:46:01 +0000
committerDaniel Thompson <daniel.thompson@linaro.org>2019-01-15 16:46:01 +0000
commit8ca640db805f6450c704a6caee03b422975035d3 (patch)
tree72476a9ad26d91f00d690eb6d7fee4671cc6437e
parent465a9bc03969b7d7b872ab9d7c759408fc788c24 (diff)
96btool: pull: Fix bootstrapping problem
It's important to be able to write out before the first copy of the db exists!
-rwxr-xr-xbin/96btool6
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/96btool b/bin/96btool
index 4e9eebe..5161060 100755
--- a/bin/96btool
+++ b/bin/96btool
@@ -699,7 +699,11 @@ def do_pull(args):
sys.stdout.flush()
posts = [ Post.post_db[k] for k in sorted(Post.post_db.keys()) ]
- os.rename(args.db, args.db + '.bak')
+ try:
+ os.rename(args.db, args.db + '.bak')
+ except FileNotFoundError:
+ pass
+
with open(args.db, 'w') as f:
ujson.dump(posts, f, sort_keys=True, indent=2)