Handle FileNotFoundError when migrating state store
This commit is contained in:
@@ -77,8 +77,11 @@ def upgrade():
|
|||||||
session = orm.scoping.scoped_session(session)
|
session = orm.scoping.scoped_session(session)
|
||||||
Puppet.query = session.query_property()
|
Puppet.query = session.query_property()
|
||||||
|
|
||||||
with open("mx-state.json") as file:
|
try:
|
||||||
data = json.load(file)
|
with open("mx-state.json") as file:
|
||||||
|
data = json.load(file)
|
||||||
|
except FileNotFoundError:
|
||||||
|
return
|
||||||
if not data:
|
if not data:
|
||||||
return
|
return
|
||||||
registrations = data.get("registrations", [])
|
registrations = data.get("registrations", [])
|
||||||
|
|||||||
Reference in New Issue
Block a user