Fixed )( and if/else

This commit is contained in:
jigen 2020-02-25 18:30:20 +01:00
parent 5d13a5c70c
commit b684ad330a

View file

@ -346,37 +346,36 @@ if __name__ == '__main__':
logger.error('Error asking certificate for {}'.format(vhost_name)) logger.error('Error asking certificate for {}'.format(vhost_name))
if args.renew: if args.renew:
pre_hook_cmd = "" pre_hook_cmd = None
post_hook_cmd = "" post_hook_cmd = None
logging.info('Renewing certificates ') logging.info('Renewing certificates ')
if set(['webmail','hosting','liste']) & set(service_reload.keys()): if set(['webmail','hosting','liste']) & set(service_reload.keys()):
post_hook_cmd += " && systemctl reload apache2") post_hook_cmd = "systemctl reload apache2"
if set(['smtp',]) & set(service_reload.keys()): elif set(['smtp',]) & set(service_reload.keys()):
post_hook_cmd += " && systemctl reload postfix") post_hook_cmd = "systemctl reload postfix"
if set(['mbox',]) & set(service_reload.keys()): elif set(['mbox',]) & set(service_reload.keys()):
post_hook_cmd += " && systemctl restart dovecot") post_hook_cmd = "systemctl restart dovecot"
logger.info("post_hook_cmd: {}".format(post_hook_cmd) logger.debug("post_hook_cmd: {}".format(post_hook_cmd))
if acme_renew(config, pre_hook_cmd, post_hook_cmd, dryrun=dryrun): if acme_renew(config, pre_hook_cmd, post_hook_cmd, dryrun=dryrun):
logger.info("Done renew") logger.info("Done renew")
else:
if set(['webmail','hosting','liste']) & set(service_reload.keys()):
if set(['webmail','hosting','liste']) & set(service_reload.keys()): # reload apache
# reload apache logger.info("Restarting apache")
logger.info("Restarting apache") # ret = subprocess.run("systemctl reload apache2")
# ret = subprocess.run("systemctl reload apache2") ret = os.system("systemctl reload apache2")
ret = os.system("systemctl reload apache2") logger.info(ret)
logger.info(ret) if set(['smtp',]) & set(service_reload.keys()):
if set(['smtp',]) & set(service_reload.keys()): # reload postfix
# reload postfix logger.info("Restarting postfix")
logger.info("Restarting postfix") # ret = subprocess.run("systemctl reload postfix")
# ret = subprocess.run("systemctl reload postfix") ret = os.system("systemctl reload postfix")
ret = os.system("systemctl reload postfix") logger.info(ret)
logger.info(ret) if set(['mbox',]) & set(service_reload.keys()):
if set(['mbox',]) & set(service_reload.keys()): # restart dovecot
# restart dovecot logger.info("Restarting dovecot")
logger.info("Restarting dovecot") # ret = subprocess.run("systemctl restart dovecot")
# ret = subprocess.run("systemctl restart dovecot") ret = os.system("systemctl restart dovecot")
ret = os.system("systemctl restart dovecot") logger.info(ret)
logger.info(ret)