Handle FileNotFoundError when migrating state store

This commit is contained in:
Tulir Asokan
2018-07-15 16:26:45 +03:00
parent 8aae5beb27
commit 0625b2d661
@@ -77,8 +77,11 @@ def upgrade():
session = orm.scoping.scoped_session(session)
Puppet.query = session.query_property()
with open("mx-state.json") as file:
data = json.load(file)
try:
with open("mx-state.json") as file:
data = json.load(file)
except FileNotFoundError:
return
if not data:
return
registrations = data.get("registrations", [])