def generate(name, domain, country, state, locale, email, keytype, keylength): """Generate an SSL/TLS certificate.""" if not domain: logger.error( "ctl:info:generate", "Choose a fully-qualified domain name of the " "certificate. Must match a domain present on the system" ) domain = click.prompt("Domain name") if not country: logger.info( "ctl:cert:generate", "Two-character country code (ex.: 'US' or 'CA')" ) country = click.prompt("Country code") if not state: state = click.prompt("State/Province") if not locale: locale = click.prompt("City/Town/Locale") if not email: email = click.prompt("Contact email [optional]") try: cmd = client().certificates.generate job, data = cmd( name, domain, country, state, locale, email, keytype, keylength) handle_job(job) except Exception as e: raise CLIException(str(e))
def request(domain): """Request a free ACME certificate from Let's Encrypt.""" if not domain: logger.error( "ctl:info:generate", "Choose a fully-qualified domain name of the " "certificate. Must match a domain present on the system") domain = click.prompt("Domain name") try: client().certificates.request_acme_certificate(domain) except Exception as e: raise CLIException(str(e))
def start(name): """Start a service""" try: client().services.start(name) svc = client().services.get(id=name) state = svc["state"] if state == "running": logger.success('ctl:svc:start', 'Started {0}'.format(name)) else: logger.error('ctl:svc:start', 'Failed to start {0}'.format(name)) except Exception as e: raise CLIException(str(e))
def request(domain): """Request a free ACME certificate from Let's Encrypt.""" if not domain: logger.error( "ctl:info:generate", "Choose a fully-qualified domain name of the " "certificate. Must match a domain present on the system" ) domain = click.prompt("Domain name") try: client().certificates.request_acme_certificate(domain) except Exception as e: raise CLIException(str(e))
def generate(name, domain, country, state, locale, email, keytype, keylength): """Generate an SSL/TLS certificate.""" if not domain: logger.error( "ctl:info:generate", "Choose a fully-qualified domain name of the " "certificate. Must match a domain present on the system") domain = click.prompt("Domain name") if not country: logger.info("ctl:cert:generate", "Two-character country code (ex.: 'US' or 'CA')") country = click.prompt("Country code") if not state: state = click.prompt("State/Province") if not locale: locale = click.prompt("City/Town/Locale") if not email: email = click.prompt("Contact email [optional]") try: cmd = client().certificates.generate job, data = cmd(name, domain, country, state, locale, email, keytype, keylength) handle_job(job) except Exception as e: raise CLIException(str(e))