Commit fd8a152b authored by Vincent Pelletier's avatar Vincent Pelletier Committed by Vincent Pelletier

cli: Do not open file to then get its path and open it again.

The intent was getting a nice error message if file was not readable, but
it causes a resource warning in python3 (file object being garbage-
collected while open - wasn't that the beauty of automatic garbage
collection to begin with ? It makes sense for writeable files as not
closing may cause race conditions, but for read-only it's just annoying).
parent b26eeb38
......@@ -809,7 +809,6 @@ def rerequest(argv=None):
parser.add_argument(
'--template',
required=True,
type=argparse.FileType('r'),
help='Existing PEM-encodd CSR to use as a template.',
)
parser.add_argument(
......@@ -832,7 +831,7 @@ def rerequest(argv=None):
)
args = parser.parse_args(argv)
template = utils.load_certificate_request(
utils.getCertRequest(args.template.name),
utils.getCertRequest(args.template),
)
key = utils.generatePrivateKey(key_len=args.key_len)
csr_pem = utils.dump_certificate_request(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment