X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=.bin%2Fle-renew;h=58e687b0b7a34ca56356ed60efcbe3fc283515ce;hb=53756ed8612888ef97a5c39a83e9ceaaed56ac91;hp=6c2354ceb29896510446aff738bfc9805fef6230;hpb=6dbeb0d66359723bd2a0446597de5616e77e583f;p=home.git diff --git a/.bin/le-renew b/.bin/le-renew index 6c2354c..58e687b 100755 --- a/.bin/le-renew +++ b/.bin/le-renew @@ -107,7 +107,12 @@ def process_domain(domain, dry_run=False): logging.info('%s: checking', domain) conf = load_conf(domain) - webroot_path = conf.get('[webroot_map', domain) + try: + webroot_path = conf.get('[webroot_map', domain) + except configparser.NoOptionError: + webroot_path = conf.get('renewalparams', 'webroot_path') + # The conf writing has a bug here where it appends a comma. + webroot_path = webroot_path.rstrip(',') cert_path = os.path.realpath(conf.get('globals', 'cert')) @@ -132,16 +137,24 @@ def process_domain(domain, dry_run=False): cmd += ['-d', d] if delta.days < 30: logging.info('%s: renewing', domain) - logging.info('%s: %s', domain, cmd) + logging.info('%s: %s', domain, ' '.join(cmd)) if not dry_run: - subprocess.check_call(cmd) + try: + subprocess.check_call(cmd) + except subprocess.CalledProcessError: + logging.error('failed', exc_info=True) + return 0 ret = 1 # Try to revoke the old one. - cmd = ['certbot', 'revoke', '--cert-path', cert_path] + cmd = ['certbot', 'revoke', '--no-delete-after-revoke', '--cert-path', + cert_path] logging.info('%s: revoking old cert', domain) - logging.info('%s: %s', domain, cmd) + logging.info('%s: %s', domain, ' '.join(cmd)) if not dry_run: - subprocess.check_call(cmd) + try: + subprocess.check_call(cmd, stdin=open('/dev/null', 'r')) + except subprocess.CalledProcessError: + logging.error('failed', exc_info=True) else: logging.info('%s: up-to-date!', domain)