Fix two problems with ipa-replica-prepare

1. Fix a unicode() problem creating the DNS entries
2. Fix a strange NSS error when generating the certificates against
   a dogtag server.

The NSS errors are quite strange. When generating the first certificate
nss_shutdown() fails because the database isn't initialized yet but
nss_is_initialized() returned True. The second pass fails because
something is in use.
This commit is contained in:
Rob Crittenden 2011-02-14 18:12:10 -05:00
parent dab452442d
commit 16b8d62968
2 changed files with 6 additions and 2 deletions

View File

@ -267,7 +267,7 @@ def main():
if not options.ip_address: if not options.ip_address:
try: try:
api.Command['dns_resolve'](replica_fqdn) api.Command['dns_resolve'](replica_fqdn.decode('utf-8'))
except errors.NotFound: except errors.NotFound:
sys.exit("Neither an A nor AAAA record for host '%s' does not exist in DNS.\nUse the --ip-address option to add DNS entries for the replica." % replica_fqdn) sys.exit("Neither an A nor AAAA record for host '%s' does not exist in DNS.\nUse the --ip-address option to add DNS entries for the replica." % replica_fqdn)

View File

@ -126,7 +126,11 @@ class NSSConnection(httplib.HTTPConnection):
if nss.nss_is_initialized(): if nss.nss_is_initialized():
# close any open NSS database and use the new one # close any open NSS database and use the new one
ssl.clear_session_cache() ssl.clear_session_cache()
try:
nss.nss_shutdown() nss.nss_shutdown()
except NSPRError, e:
# FIXME: errors shouldn't be raised here
logging.debug('nss_shutdown: %s', str(e))
nss.nss_init(dbdir) nss.nss_init(dbdir)
ssl.set_domestic_policy() ssl.set_domestic_policy()
nss.set_password_callback(self.password_callback) nss.set_password_callback(self.password_callback)