#4884 Need a simple way to check server installation
Closed: Invalid None Opened 9 years ago by edewata.

Currently there seems to be no easy and reliable way to check if IPA server is installed on a system. Ideally there should be a well-known server-specific file or folder (e.g. /var/lib/ipa) that people can check. If it exists that means IPA server is installed (even if the installation failed). If it doesn't exist that means the system is clean.

However, currently the /var/lib/ipa is owned by the package, so it always exists. Checking DS or Dogtag folders is not reliable because someone might have created DS or Dogtag instances with the same names used by IPA but did not actually install IPA server.

There is a code in ipaserver/install/installutils.py to check for IPA server installation, but it does not seem to be accessible via CLI:

def is_ipa_configured():
    """
    Using the state and index install files determine if IPA is already
    configured.
    """
    installed = False

    sstore = sysrestore.StateFile(paths.SYSRESTORE)
    fstore = sysrestore.FileStore(paths.SYSRESTORE)

    for module in IPA_MODULES:
        if sstore.has_state(module):
            root_logger.debug('%s is configured' % module)
            installed = True
        else:
            root_logger.debug('%s is not configured' % module)

    if fstore.has_files():
        root_logger.debug('filestore has files')
        installed = True
    else:
        root_logger.debug('filestore is tracking no files')

    return installed

One possibility is to create the /var/lib/ipa only when the IPA server is installed, and remove it when the server is uninstalled. Any residual files currently stored in this folder need to be moved somewhere else.


Nathaniel: with increasing modularity, this call would not make much sense. Test for the specific features (389, web services) for a certain call, test for those instead of "is ipa installed".

Additional info for interested:

Honza: What's wrong with ipaserver.installutils.is_ipa_configured?

Endi: The Python code cannot be called directly from command line. Need something simple like a folder or a CLI (e.g. ipa-server-install --status).

You can use python2 -c 'import sys; from ipaserver.install.installutils import is_ipa_configured; sys.exit(is_ipa_configured())'

What is the use case?

ab: I agree, this seems to be very marginal, calling a simple Python sequence is easy

Right. This is what FreeIPA RPM %post does. The API is still not guaranteed though. Create call "api.server_installed()" and "api.client_installed"?

Use case: admin checking the installation status of a machine. The above python call is too long to remember. How about ipa-server-install --status

Metadata Update from @edewata:
- Issue assigned to someone
- Issue set to the milestone: 0.0 NEEDS_TRIAGE

7 years ago

Login to comment on this ticket.

Metadata