From bb52241c121b008317ecb6c824696bea5ec75c8e Mon Sep 17 00:00:00 2001 From: Christopher Gallo Date: Tue, 2 Jan 2024 14:15:01 -0600 Subject: [PATCH] fixed #2078, marked --crt and --key as required for slcli ssl add --- SoftLayer/CLI/security/cert_add.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/SoftLayer/CLI/security/cert_add.py b/SoftLayer/CLI/security/cert_add.py index 9115e95c8..2755ddd6c 100644 --- a/SoftLayer/CLI/security/cert_add.py +++ b/SoftLayer/CLI/security/cert_add.py @@ -8,16 +8,10 @@ @click.command(cls=SoftLayer.CLI.command.SLCommand, ) -@click.option('--crt', - type=click.Path(exists=True), - help="Certificate file") -@click.option('--csr', - type=click.Path(exists=True), - help="Certificate Signing Request file") -@click.option('--icc', - type=click.Path(exists=True), - help="Intermediate Certificate file") -@click.option('--key', type=click.Path(exists=True), help="Private Key file") +@click.option('--crt', required=True, type=click.Path(exists=True), help="Certificate file") +@click.option('--key', type=click.Path(exists=True), required=True, help="Private Key file") +@click.option('--csr', type=click.Path(exists=True), help="Certificate Signing Request file") +@click.option('--icc', type=click.Path(exists=True), help="Intermediate Certificate file") @click.option('--notes', help="Additional notes") @environment.pass_env def cli(env, crt, csr, icc, key, notes): @@ -32,13 +26,13 @@ def cli(env, crt, csr, icc, key, notes): template['certificate'] = file_crt.read() with open(key, encoding="utf-8") as file_key: template['privateKey'] = file_key.read() - with open(csr, encoding="utf-8") as file_csr: - if csr: + if csr: + with open(csr, encoding="utf-8") as file_csr: body = file_csr.read() template['certificateSigningRequest'] = body - with open(icc, encoding="utf-8") as file_icc: - if icc: + if icc: + with open(icc, encoding="utf-8") as file_icc: body = file_icc.read() template['intermediateCertificate'] = body