mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Use the is_ipa_configure() and is_ipa_client_configured() utilities instead which are much more robust. https://pagure.io/freeipa/issue/8384 Signed-off-by: Rob Crittenden <rcritten@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com> Reviewed-By: Francois Cami <fcami@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com> Reviewed-By: Francois Cami <fcami@redhat.com> Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
#
|
|
# Copyright (C) 2020 FreeIPA Contributors see COPYING for license
|
|
#
|
|
|
|
"""
|
|
Facts about the installation
|
|
"""
|
|
|
|
import os
|
|
from . import sysrestore
|
|
from ipaplatform.paths import paths
|
|
|
|
|
|
def is_ipa_configured():
|
|
"""
|
|
Use the state to determine if IPA has been configured.
|
|
"""
|
|
sstore = sysrestore.StateFile(paths.SYSRESTORE)
|
|
return sstore.get_state('installation', 'complete')
|
|
|
|
|
|
def is_ipa_client_configured(on_master=False):
|
|
"""
|
|
Consider IPA client not installed if nothing is backed up
|
|
and default.conf file does not exist. If on_master is set to True,
|
|
the existence of default.conf file is not taken into consideration,
|
|
since it has been already created by ipa-server-install.
|
|
"""
|
|
fstore = sysrestore.FileStore(paths.IPA_CLIENT_SYSRESTORE)
|
|
statestore = sysrestore.StateFile(paths.IPA_CLIENT_SYSRESTORE)
|
|
|
|
installed = statestore.get_state('installation', 'complete')
|
|
if installed is not None:
|
|
return installed
|
|
|
|
# Fall back to the old detection
|
|
|
|
installed = (
|
|
fstore.has_files() or (
|
|
not on_master and os.path.exists(paths.IPA_DEFAULT_CONF)
|
|
)
|
|
)
|
|
|
|
return installed
|