Fall back to old server installation detection when needed

If there is no installation section the the install pre-dated
this new method of detecting a successful installation, fall back
to that.

https://pagure.io/freeipa/issue/8458

Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: Stanislav Levin <slev@altlinux.org>
Reviewed-By: Alexander Bokovoy <abbra@users.noreply.github.com>
This commit is contained in:
Rob Crittenden authored and Florence Blanc-Renaud committed 2020-08-18 11:11:26 +02:00
1 parent af5138c2aa
commit a8d5e6bbfe
4 files changed
+37 -8

No files matched your search

+30 -1
View File
@@ -6,17 +6,46 @@
Facts about the installation
"""
import logging
import os
from . import sysrestore
from ipaplatform.paths import paths
logger = logging.getLogger(__name__)
# Used to determine install status
IPA_MODULES = [
'httpd', 'kadmin', 'dirsrv', 'pki-tomcatd', 'install', 'krb5kdc', 'named']
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')
if sstore.has_state('installation'):
return sstore.get_state('installation', 'complete')
# Fall back to older method in case this is an existing installation
installed = False
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
def is_ipa_client_configured(on_master=False):
-4
View File
@@ -63,10 +63,6 @@ if six.PY3:
logger = logging.getLogger(__name__)
# Used to determine install status
IPA_MODULES = [
'httpd', 'kadmin', 'dirsrv', 'pki-tomcatd', 'install', 'krb5kdc', 'named']
class BadHostError(Exception):
pass
+2 -1
View File
@@ -37,13 +37,14 @@ from ipalib.util import (
validate_domain_name,
no_matching_interface_for_ip_address_warning,
)
from ipalib.facts import IPA_MODULES
from ipaserver.install import (
adtrust, adtrustinstance, bindinstance, ca, dns, dsinstance,
httpinstance, installutils, kra, krbinstance,
otpdinstance, custodiainstance, replication, service,
sysupgrade, cainstance)
from ipaserver.install.installutils import (
IPA_MODULES, BadHostError, get_fqdn, get_server_ip_address,
BadHostError, get_fqdn, get_server_ip_address,
load_pkcs12, read_password, verify_fqdn, update_hosts_file,
validate_mask)
+5 -2
View File
@@ -1486,8 +1486,11 @@ def upgrade_configuration():
fstore = sysrestore.FileStore(paths.SYSRESTORE)
sstore = sysrestore.StateFile(paths.SYSRESTORE)
if is_ipa_configured() is None:
sstore.backup_state('installation', 'complete', True)
if not sstore.has_state('installation'):
if is_ipa_configured():
sstore.backup_state('installation', 'complete', True)
else:
sstore.backup_state('installation', 'complete', False)
fqdn = api.env.host