Update src/allmydata/cli/grid_manager.py

Co-authored-by: Jean-Paul Calderone <exarkun@twistedmatrix.com>
This commit is contained in:
meejah 2023-02-21 00:04:03 -07:00 committed by GitHub
parent 039c1d8037
commit 43d29986a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -205,13 +205,10 @@ def sign(ctx, name, expiry_days):
fname = "{}.cert.{}".format(name, next_serial)
try:
f = fp.child(fname).create()
except FileExistsError:
f = None
except OSError as e:
if e.errno == 17: # file exists
f = None
else:
raise click.ClickException(
"{}: {}".format(fname, e)
)
raise click.ClickException(f"{fname}: {e}")
next_serial += 1
with f:
f.write(certificate_data.encode("ascii"))