diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py index ba98e8bed..f19f64fbe 100644 --- a/ipaserver/install/installutils.py +++ b/ipaserver/install/installutils.py @@ -700,28 +700,10 @@ def rmtree(path): def is_ipa_configured(): """ - Using the state and index install files determine if IPA is already - configured. + Use the state to determine if IPA has been configured. """ - installed = False - sstore = sysrestore.StateFile(paths.SYSRESTORE) - fstore = sysrestore.FileStore(paths.SYSRESTORE) - - for module in IPA_MODULES: - if sstore.has_state(module): - logger.debug('%s is configured', module) - installed = True - else: - logger.debug('%s is not configured', module) - - if fstore.has_files(): - logger.debug('filestore has files') - installed = True - else: - logger.debug('filestore is tracking no files') - - return installed + return sstore.get_state('installation', 'complete') def run_script(main_function, operation_name, log_file_name=None, diff --git a/ipaserver/install/server/install.py b/ipaserver/install/server/install.py index 1eee9e7a9..137eee2b0 100644 --- a/ipaserver/install/server/install.py +++ b/ipaserver/install/server/install.py @@ -808,6 +808,9 @@ def install(installer): # failure to enable root cause investigation installer._installation_cleanup = False + # Be clear that the installation process is beginning but not done + sstore.backup_state('installation', 'complete', False) + if installer.interactive: print("") print("The following operations may take some minutes to complete.") @@ -1010,6 +1013,8 @@ def install(installer): bind.create_file_with_system_records() # Everything installed properly, activate ipa service. + sstore.delete_state('installation', 'complete') + sstore.backup_state('installation', 'complete', True) services.knownservices.ipa.enable() print("=======================================" @@ -1215,6 +1220,7 @@ def uninstall(installer): if fstore.has_files(): logger.error('Some files have not been restored, see ' '%s/sysrestore.index', SYSRESTORE_DIR_PATH) + sstore.delete_state('installation', 'complete') has_state = False for module in IPA_MODULES: # from installutils if sstore.has_state(module): diff --git a/ipaserver/install/server/replicainstall.py b/ipaserver/install/server/replicainstall.py index 7d6c4108c..b8e896ac7 100644 --- a/ipaserver/install/server/replicainstall.py +++ b/ipaserver/install/server/replicainstall.py @@ -1205,6 +1205,7 @@ def install(installer): ca_enabled = installer._ca_enabled kra_enabled = installer._kra_enabled fstore = installer._fstore + sstore = installer._sstore config = installer._config cafile = installer._ca_file dirsrv_pkcs12_info = installer._dirsrv_pkcs12_info @@ -1215,6 +1216,9 @@ def install(installer): conn = remote_api.Backend.ldap2 ccache = os.environ['KRB5CCNAME'] + # Be clear that the installation process is beginning but not done + sstore.backup_state('installation', 'complete', False) + if tasks.configure_pkcs11_modules(fstore): print("Disabled p11-kit-proxy") @@ -1371,6 +1375,8 @@ def install(installer): api.Backend.ldap2.disconnect() # Everything installed properly, activate ipa service. + sstore.delete_state('installation', 'complete') + sstore.backup_state('installation', 'complete', True) services.knownservices.ipa.enable() # Print a warning if CA role is only installed on one server diff --git a/ipaserver/install/server/upgrade.py b/ipaserver/install/server/upgrade.py index 61e7af34d..af403c6da 100644 --- a/ipaserver/install/server/upgrade.py +++ b/ipaserver/install/server/upgrade.py @@ -1482,6 +1482,10 @@ def upgrade_configuration(): logger.debug('IPA version %s', version.VENDOR_VERSION) fstore = sysrestore.FileStore(paths.SYSRESTORE) + sstore = sysrestore.StateFile(paths.SYSRESTORE) + + if installutils.is_ipa_configured() is None: + sstore.backup_state('installation', 'complete', True) fqdn = api.env.host