Only try to open the identity2.json if it exists
@@ -43,8 +43,12 @@ class IdentityManager:
def _load():
LOG.debug('Loading identity')
try:
- with FileSystemAccess('identity').open('identity2.json', 'r') as f:
+ identity_dir = FileSystemAccess('identity')
+ if identity_dir.exists('identity2.json'):
+ with identity_dir.open('identity2.json', 'r') as f:
IdentityManager.__identity = DeviceIdentity(**json.load(f))
+ else:
+ IdentityManager.__identity = DeviceIdentity()
except Exception:
IdentityManager.__identity = DeviceIdentity()
