remove pgp retry mechanism
This commit is contained in:
parent
9b1ca0a2f1
commit
582a971b80
|
@ -43,15 +43,12 @@ def encrypt_file(data: BytesIO, fingerprint: str) -> str:
|
||||||
|
|
||||||
r = gpg.encrypt_file(data, fingerprint, always_trust=True)
|
r = gpg.encrypt_file(data, fingerprint, always_trust=True)
|
||||||
if not r.ok:
|
if not r.ok:
|
||||||
LOG.error("Try encrypt again %s", fingerprint)
|
# save the content for debugging
|
||||||
r = gpg.encrypt_file(data, fingerprint, always_trust=True)
|
random_file_name = random_string(20) + ".eml"
|
||||||
if not r.ok:
|
full_path = f"/tmp/{random_file_name}"
|
||||||
# save the content for debugging
|
with open(full_path, "wb") as f:
|
||||||
random_file_name = random_string(20) + ".eml"
|
f.write(data.getbuffer())
|
||||||
full_path = f"/tmp/{random_file_name}"
|
LOG.error("PGP fail - log to %s", full_path)
|
||||||
with open(full_path, "wb") as f:
|
raise PGPException("Cannot encrypt")
|
||||||
f.write(data.getbuffer())
|
|
||||||
LOG.error("PGP fail - log to %s", full_path)
|
|
||||||
raise PGPException("Cannot encrypt")
|
|
||||||
|
|
||||||
return str(r)
|
return str(r)
|
||||||
|
|
Loading…
Reference in a new issue