Handle missing identity file in rncp. Fixes #317.
This commit is contained in:
parent
45295c779c
commit
a8a7af4b74
@ -452,7 +452,7 @@ class Identity:
|
|||||||
return False
|
return False
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
RNS.log("Error while loading identity from "+str(path), RNS.LOG_ERROR)
|
RNS.log("Error while loading identity from "+str(path), RNS.LOG_ERROR)
|
||||||
RNS.log("The contained exception was: "+str(e))
|
RNS.log("The contained exception was: "+str(e), RNS.LOG_ERROR)
|
||||||
|
|
||||||
def get_salt(self):
|
def get_salt(self):
|
||||||
return self.hash
|
return self.hash
|
||||||
|
@ -226,7 +226,12 @@ def send(configdir, verbosity = 0, quietness = 0, destination = None, file = Non
|
|||||||
|
|
||||||
identity_path = RNS.Reticulum.identitypath+"/"+APP_NAME
|
identity_path = RNS.Reticulum.identitypath+"/"+APP_NAME
|
||||||
if os.path.isfile(identity_path):
|
if os.path.isfile(identity_path):
|
||||||
identity = RNS.Identity.from_file(identity_path)
|
identity = RNS.Identity.from_file(identity_path)
|
||||||
|
if identity == None:
|
||||||
|
RNS.log("Could not load identity for rncp. The identity file at \""+str(identity_path)+"\" may be corrupt or unreadable.", RNS.LOG_ERROR)
|
||||||
|
exit(2)
|
||||||
|
else:
|
||||||
|
identity = None
|
||||||
|
|
||||||
if identity == None:
|
if identity == None:
|
||||||
RNS.log("No valid saved identity found, creating new...", RNS.LOG_INFO)
|
RNS.log("No valid saved identity found, creating new...", RNS.LOG_INFO)
|
||||||
|
Loading…
Reference in New Issue
Block a user