Simplify the install_replica_ca function

Instantiate CAInstall only once instead of 3 times in a row always with the
same values.

Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
Simo Sorce authored and Jan Cholasta committed 2015-09-22 10:44:45 +02:00
1 parent 953b1079cf
commit d8b1f42f17
1 file changed
+5 -10
+5 -10
View File
@@ -1505,24 +1505,19 @@ def install_replica_ca(config, postinstall=False):
# Replica of old "self-signed" master - skip installing CA
return None
ca = CAInstance(config.realm_name, certs.NSS_DIR,
dogtag_constants=dogtag.install_constants)
ca.dm_password = config.dirman_password
ca.subject_base = config.subject_base
if not config.setup_ca:
# We aren't configuring the CA in this step but we still need
# a minimum amount of information on the CA for this IPA install.
ca = CAInstance(config.realm_name, certs.NSS_DIR,
dogtag_constants=dogtag.install_constants)
ca.dm_password = config.dirman_password
ca.subject_base = config.subject_base
return ca
ca = CAInstance(config.realm_name, certs.NSS_DIR,
dogtag_constants=dogtag.install_constants)
ca.dm_password = config.dirman_password
ca.subject_base = config.subject_base
if ca.is_installed():
sys.exit("A CA is already configured on this system.")
ca = CAInstance(config.realm_name, certs.NSS_DIR,
dogtag_constants=dogtag.install_constants)
if postinstall:
# If installing this afterward the Apache NSS database already
# exists, don't remove it.