Skip to content

Commit c972ba1

Browse files
strautvetterpiraz
authored andcommitted
Added arg output_filename to cli issue command
1 parent 4bb3843 commit c972ba1

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

automatoes/cli/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def _issue(args):
8787
key_file=args.key_file,
8888
csr_file=args.csr_file,
8989
output_path=args.output,
90+
output_filename=args.output_filename,
9091
must_staple=args.ocsp_must_staple,
9192
verbose=verbose
9293
)
@@ -228,6 +229,9 @@ def manuale_main():
228229
issue_sub.add_argument('--output', '-o',
229230
help="The output directory for created objects",
230231
default='.')
232+
issue_sub.add_argument('--output-filename',
233+
help="The filename base for created objects",
234+
default=None)
231235
issue_sub.add_argument('--ocsp-must-staple',
232236
dest='ocsp_must_staple',
233237
help="CSR: Request OCSP Must-Staple extension",

automatoes/issue.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151

5252
def issue(server, paths, account, domains, key_size, key_file=None,
53-
csr_file=None, output_path=None, must_staple=False, verbose=False):
53+
csr_file=None, output_path=None, output_filename=None, must_staple=False, verbose=False):
5454
print("Candango Automatoes {}. Manuale replacement.\n\n".format(
5555
get_version()))
5656

@@ -195,11 +195,12 @@ def issue(server, paths, account, domains, key_size, key_file=None,
195195

196196
# Write the key, certificate and full chain
197197
os.makedirs(output_path, exist_ok=True)
198-
cert_path = os.path.join(output_path, domains[0] + '.crt')
199-
chain_path = os.path.join(output_path, domains[0] + '.chain.crt')
198+
cert_name = output_filename if output_filename else domains[0]
199+
cert_path = os.path.join(output_path, cert_name + '.crt')
200+
chain_path = os.path.join(output_path, cert_name + '.chain.crt')
200201
intermediate_path = os.path.join(output_path,
201-
domains[0] + '.intermediate.crt')
202-
key_path = os.path.join(output_path, domains[0] + '.pem')
202+
cert_name + '.intermediate.crt')
203+
key_path = os.path.join(output_path, cert_name + '.pem')
203204

204205
if order.key is not None:
205206
with open(key_path, 'wb') as f:

0 commit comments

Comments
 (0)