Merge restart_httpd functionality to renew_ra_cert.

Reviewed-By: Petr Viktorin <pviktori@redhat.com>
This commit is contained in:
Jan Cholasta 2013-10-16 09:04:21 +00:00 committed by Petr Viktorin
parent 2c466b79e8
commit fac6bf30b6
2 changed files with 11 additions and 9 deletions

View File

@ -34,15 +34,17 @@ def main():
api.bootstrap(context='restart')
api.finalize()
# Fetch the new certificate
db = certs.CertDB(api.env.realm)
dercert = db.get_cert_from_db(nickname, pem=False)
if not dercert:
syslog.syslog(syslog.LOG_ERR, 'No certificate %s found.' % nickname)
sys.exit(1)
ca = cainstance.CAInstance(api.env.realm, certs.NSS_DIR)
if ca.is_renewal_master():
# Fetch the new certificate
db = certs.CertDB(api.env.realm)
dercert = db.get_cert_from_db(nickname, pem=False)
if not dercert:
syslog.syslog(syslog.LOG_ERR, 'No certificate %s found.' % nickname)
sys.exit(1)
# Load it into dogtag
cainstance.update_people_entry(dercert)
# Load it into dogtag
cainstance.update_people_entry(dercert)
# Now restart Apache so the new certificate is available
syslog.syslog(syslog.LOG_NOTICE, "Restarting httpd")

View File

@ -925,7 +925,7 @@ class CAInstance(service.Service):
pinfile='/etc/httpd/alias/pwdfile.txt',
secdir='/etc/httpd/alias',
pre_command=None,
post_command='restart_httpd')
post_command='renew_ra_cert')
except (ipautil.CalledProcessError, RuntimeError), e:
root_logger.error(
"certmonger failed to start tracking certificate: %s" % str(e))