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'))
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)