diff options
-rwxr-xr-x | client/ipa-client-install | 20 | ||||
-rw-r--r-- | ipaclient/install/client.py | 21 |
2 files changed, 24 insertions, 17 deletions
diff --git a/client/ipa-client-install b/client/ipa-client-install index 7959bac22..f82fb9afb 100755 --- a/client/ipa-client-install +++ b/client/ipa-client-install @@ -28,10 +28,8 @@ from optparse import SUPPRESS_HELP, OptionGroup, OptionValueError from ipaclient.install import client from ipapython.ipa_log_manager import standard_logging_setup, root_logger -from ipapython.ipautil import is_fips_enabled -from ipaplatform.tasks import tasks from ipaplatform.paths import paths -from ipapython import version, sysrestore +from ipapython import version from ipapython.config import IPAOptionParser from ipalib import x509 from ipalib.util import normalize_hostname, validate_domain_name @@ -223,15 +221,8 @@ def logging_setup(options): def main(): - fstore = sysrestore.FileStore(paths.IPA_CLIENT_SYSRESTORE) safe_options, options = parse_options() - if not os.getegid() == 0: - sys.exit("\nYou must be root to run ipa-client-install.\n") - if is_fips_enabled(): - sys.exit("Installing IPA client in FIPS mode is not supported") - - tasks.check_selinux_status() logging_setup(options) root_logger.debug( '%s was invoked with options: %s', sys.argv[0], safe_options) @@ -243,12 +234,9 @@ def main(): if options.uninstall: return client.uninstall(options, env) - if client.is_ipa_client_installed(fstore, on_master=options.on_master): - root_logger.error("IPA client is already configured on this system.") - root_logger.info( - "If you want to reinstall the IPA client, uninstall it first " + - "using 'ipa-client-install --uninstall'.") - return client.CLIENT_ALREADY_CONFIGURED + rval_check = client.install_check(options) + if rval_check != client.SUCCESS: + return rval_check rval = client.install(options, env) if rval == client.CLIENT_INSTALL_ERROR: diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py index cf41c068a..cdc9264f6 100644 --- a/ipaclient/install/client.py +++ b/ipaclient/install/client.py @@ -65,13 +65,13 @@ from ipapython.ipautil import ( CalledProcessError, dir_exists, file_exists, + is_fips_enabled, realm_to_suffix, run, user_input, ) from ipapython.ssh import SSHPublicKey - SUCCESS = 0 CLIENT_INSTALL_ERROR = 1 CLIENT_NOT_CONFIGURED = 2 @@ -1918,6 +1918,25 @@ def purge_host_keytab(realm): realm, paths.KRB5_KEYTAB) +def install_check(options): + fstore = sysrestore.FileStore(paths.IPA_CLIENT_SYSRESTORE) + if not os.getegid() == 0: + sys.exit("\nYou must be root to run ipa-client-install.\n") + + if is_fips_enabled(): + sys.exit("Installing IPA client in FIPS mode is not supported") + + tasks.check_selinux_status() + + if is_ipa_client_installed(fstore, on_master=options.on_master): + root_logger.error("IPA client is already configured on this system.") + root_logger.info( + "If you want to reinstall the IPA client, uninstall it first " + + "using 'ipa-client-install --uninstall'.") + return CLIENT_ALREADY_CONFIGURED + return SUCCESS + + def install(options, env): fstore = sysrestore.FileStore(paths.IPA_CLIENT_SYSRESTORE) statestore = sysrestore.StateFile(paths.IPA_CLIENT_SYSRESTORE) |