From 8c2ea209c55cf7cee0485a9695351a3aa6622bb8 Mon Sep 17 00:00:00 2001 From: jigen Date: Wed, 16 Sep 2020 18:43:49 +0200 Subject: [PATCH] Added check for apache config section --- OTcerts.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/OTcerts.py b/OTcerts.py index 87266d0..1f194d6 100644 --- a/OTcerts.py +++ b/OTcerts.py @@ -1,4 +1,5 @@ + import os import sys import errno @@ -276,10 +277,9 @@ if __name__ == '__main__': if acme_renew(config, pre_hook_cmd, post_hook_cmd, dryrun=dryrun): logger.info("Done renew") - - else: + else: # Fai le nuove richieste per i certificati - + # Caso speciale per le webmail if args.webmail: logging.info('Asking certificates for webmail') @@ -290,7 +290,7 @@ if __name__ == '__main__': link_cert(config, vhost_name, vhost_name, dryrun=dryrun) else: logger.error('Error asking certificate for {}'.format(vhost_name)) - + # reload apache logger.info("Reloading apache") # ret = subprocess.run("systemctl reload apache2") @@ -300,6 +300,12 @@ if __name__ == '__main__': # Caso speciale per l'hosting if args.hosting: logging.info('Asking certificates for hosted web domains') + try: + hosting_conf = config['apache'] + except KeyError as e: + logger.error("Error parsing configuration, KeyError {}".format(e)) + exit(-1) + ot_conn=connect_db(dict(config['ot_db'])) dns_conn=connect_db(dict(config['dns_db'])) # Subdomains da escludere