From 2fcc260cae4bd1186a7312c61a63144e8d656cd0 Mon Sep 17 00:00:00 2001 From: Fraser Tweedale Date: Tue, 6 Mar 2018 17:07:32 +1100 Subject: [PATCH] cainstance.update_ipa_conf: allow specifying ca_host Enhance cainstance.update_ipa_conf() to allow specifying the ca_host. This will be used to update replica configurations when a CA-less deployment gets promoted to CA-ful. Part of: https://pagure.io/freeipa/issue/7188 Reviewed-By: Florence Blanc-Renaud --- ipaserver/install/cainstance.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ipaserver/install/cainstance.py b/ipaserver/install/cainstance.py index 473b17bef..9b9d32f5e 100644 --- a/ipaserver/install/cainstance.py +++ b/ipaserver/install/cainstance.py @@ -2205,17 +2205,20 @@ def add_lightweight_ca_tracking_requests(lwcas): 'already tracking certificate "%s"', nickname) -def update_ipa_conf(): +def update_ipa_conf(ca_host=None): """ Update IPA configuration file to ensure that RA plugins are enabled and - that CA host points to localhost + that CA host points to specified server (or localhost if ca_host=None). """ parser = RawConfigParser() parser.read(paths.IPA_DEFAULT_CONF) parser.set('global', 'enable_ra', 'True') parser.set('global', 'ra_plugin', 'dogtag') parser.set('global', 'dogtag_version', '10') - parser.remove_option('global', 'ca_host') + if ca_host is None: + parser.remove_option('global', 'ca_host') + else: + parser.set('global', 'ca_host', ca_host) with open(paths.IPA_DEFAULT_CONF, 'w') as f: parser.write(f)