Properly handle CertificateOperationErrors in replication prepration.

The problem here was two-fold: the certs manager was raising an
error it didn't know about and ipa-replica-prepare wasn't catching it.

ticket 249
This commit is contained in:
Rob Crittenden
2010-09-20 13:35:32 -04:00
parent ed56112023
commit 2951901d1e
2 changed files with 11 additions and 2 deletions

View File

@@ -283,7 +283,11 @@ def main():
print "Copy failed %s" % e print "Copy failed %s" % e
sys.exit(1) sys.exit(1)
print "Creating SSL certificate for the Directory Server" print "Creating SSL certificate for the Directory Server"
export_certdb(api.env.realm, ds_dir, dir, passwd_fname, "dscert", replica_fqdn, subject_base) try:
export_certdb(api.env.realm, ds_dir, dir, passwd_fname, "dscert", replica_fqdn, subject_base)
except errors.CertificateOperationError, e:
print "%s" % e
sys.exit(1)
if options.http_pin: if options.http_pin:
passwd = options.http_pin passwd = options.http_pin
@@ -304,7 +308,11 @@ def main():
sys.exit(1) sys.exit(1)
else: else:
print "Creating SSL certificate for the Web Server" print "Creating SSL certificate for the Web Server"
export_certdb(api.env.realm, ds_dir, dir, passwd_fname, "httpcert", replica_fqdn, subject_base) try:
export_certdb(api.env.realm, ds_dir, dir, passwd_fname, "httpcert", replica_fqdn, subject_base)
except errors.CertificateOperationError, e:
print "%s" % e
sys.exit(1)
print "Exporting RA certificate" print "Exporting RA certificate"
export_ra_pkcs12(dir, dirman_password) export_ra_pkcs12(dir, dirman_password)

View File

@@ -37,6 +37,7 @@ from ipalib import pkcs10
from ConfigParser import RawConfigParser from ConfigParser import RawConfigParser
import service import service
from ipalib import x509 from ipalib import x509
from ipalib.errors import CertificateOperationError
from nss.error import NSPRError from nss.error import NSPRError
import nss.nss as nss import nss.nss as nss