diff options
Diffstat (limited to 'ipa-client')
-rwxr-xr-x | ipa-client/ipa-install/ipa-client-automount | 17 | ||||
-rwxr-xr-x | ipa-client/ipa-install/ipa-client-install | 56 | ||||
-rw-r--r-- | ipa-client/ipaclient/ntpconf.py | 19 |
3 files changed, 47 insertions, 45 deletions
diff --git a/ipa-client/ipa-install/ipa-client-automount b/ipa-client/ipa-install/ipa-client-automount index 0841952cb..7c7491b5d 100755 --- a/ipa-client/ipa-install/ipa-client-automount +++ b/ipa-client/ipa-install/ipa-client-automount @@ -39,6 +39,7 @@ from ipapython.ipa_log_manager import * from ipapython.dn import DN from ipapython import services as ipaservices from ipaplatform import tasks +from ipaplatform import services AUTOFS_CONF = '/etc/sysconfig/autofs' NSSWITCH_CONF = '/etc/nsswitch.conf' @@ -192,7 +193,7 @@ def configure_autofs_sssd(fstore, statestore, autodiscover, options): sssdconfig.write("/etc/sssd/sssd.conf") statestore.backup_state('autofs', 'sssd', True) - sssd = ipaservices.service('sssd') + sssd = services.service('sssd') sssd.restart() print "Restarting sssd, waiting for it to become available." wait_for_sssd() @@ -227,7 +228,7 @@ def configure_autofs(fstore, statestore, autodiscover, server, options): print "Configured %s" % AUTOFS_CONF def configure_autofs_common(fstore, statestore, options): - autofs = ipaservices.knownservices.autofs + autofs = services.knownservices.autofs statestore.backup_state('autofs', 'enabled', autofs.is_enabled()) statestore.backup_state('autofs', 'running', autofs.is_running()) try: @@ -257,7 +258,7 @@ def uninstall(fstore, statestore): enabled = statestore.restore_state('autofs', 'enabled') running = statestore.restore_state('autofs', 'running') sssd = statestore.restore_state('autofs', 'sssd') - autofs = ipaservices.knownservices.autofs + autofs = services.knownservices.autofs if not enabled: autofs.disable() if not running: @@ -280,7 +281,7 @@ def uninstall(fstore, statestore): break sssdconfig.save_domain(domain) sssdconfig.write("/etc/sssd/sssd.conf") - sssd = ipaservices.service('sssd') + sssd = services.service('sssd') sssd.restart() wait_for_sssd() except Exception, e: @@ -289,7 +290,7 @@ def uninstall(fstore, statestore): if statestore.has_state('rpcidmapd'): enabled = statestore.restore_state('rpcidmapd', 'enabled') running = statestore.restore_state('rpcidmapd', 'running') - rpcidmapd = ipaservices.knownservices.rpcidmapd + rpcidmapd = services.knownservices.rpcidmapd if not enabled: rpcidmapd.disable() if not running: @@ -297,7 +298,7 @@ def uninstall(fstore, statestore): if statestore.has_state('rpcgssd'): enabled = statestore.restore_state('rpcgssd', 'enabled') running = statestore.restore_state('rpcgssd', 'running') - rpcgssd = ipaservices.knownservices.rpcgssd + rpcgssd = services.knownservices.rpcgssd if not enabled: rpcgssd.disable() if not running: @@ -327,7 +328,7 @@ def configure_nfs(fstore, statestore): print "Configured %s" % IDMAPD_CONF - rpcidmapd = ipaservices.knownservices.rpcidmapd + rpcidmapd = services.knownservices.rpcidmapd statestore.backup_state('rpcidmapd', 'enabled', rpcidmapd.is_enabled()) statestore.backup_state('rpcidmapd', 'running', rpcidmapd.is_running()) try: @@ -341,7 +342,7 @@ def configure_nfs(fstore, statestore): print "Failed to configure automatic startup of the %s daemon" % (rpcidmapd.service_name) root_logger.error("Failed to enable automatic startup of the %s daemon: %s" % (rpcidmapd.service_name, str(e))) - rpcgssd = ipaservices.knownservices.rpcgssd + rpcgssd = services.knownservices.rpcgssd statestore.backup_state('rpcgssd', 'enabled', rpcgssd.is_enabled()) statestore.backup_state('rpcgssd', 'running', rpcgssd.is_running()) try: diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install index 3a5c127b8..1e17dee4c 100755 --- a/ipa-client/ipa-install/ipa-client-install +++ b/ipa-client/ipa-install/ipa-client-install @@ -317,7 +317,7 @@ def nssldap_exists(): # helper function for uninstall # deletes IPA domain from sssd.conf def delete_ipa_domain(): - sssd = ipaservices.service('sssd') + sssd = services.service('sssd') try: sssdconfig = SSSDConfig.SSSDConfig() sssdconfig.import_config() @@ -492,13 +492,13 @@ def uninstall(options, env): # Always start certmonger. We can't untrack something if it isn't # running - messagebus = ipaservices.knownservices.messagebus + messagebus = services.knownservices.messagebus try: messagebus.start() except Exception, e: log_service_error(messagebus.service_name, 'start', e) - cmonger = ipaservices.knownservices.certmonger + cmonger = services.knownservices.certmonger try: cmonger.start() except Exception, e: @@ -562,7 +562,7 @@ def uninstall(options, env): if fstore.has_files(): was_sssd_installed = fstore.has_file("/etc/sssd/sssd.conf") - sshd_config = os.path.join(ipaservices.knownservices.sshd.get_config_dir(), "sshd_config") + sshd_config = os.path.join(services.knownservices.sshd.get_config_dir(), "sshd_config") was_sshd_configured = fstore.has_file(sshd_config) try: tasks.restore_pre_ipa_client_configuration(fstore, @@ -603,7 +603,7 @@ def uninstall(options, env): root_logger.info("IPA domain removed from current one, " + "restarting SSSD service") - sssd = ipaservices.service('sssd') + sssd = services.service('sssd') try: sssd.restart() except CalledProcessError: @@ -616,7 +616,7 @@ def uninstall(options, env): root_logger.info("Other domains than IPA domain found, " + "IPA domain was removed from /etc/sssd/sssd.conf.") - sssd = ipaservices.service('sssd') + sssd = services.service('sssd') try: sssd.restart() except CalledProcessError: @@ -634,7 +634,7 @@ def uninstall(options, env): root_logger.info("Redundant SSSD configuration file " + "/etc/sssd/sssd.conf was moved to /etc/sssd/sssd.conf.deleted") - sssd = ipaservices.service('sssd') + sssd = services.service('sssd') try: sssd.stop() except CalledProcessError: @@ -654,8 +654,8 @@ def uninstall(options, env): ipautil.restore_hostname(statestore) unconfigure_nisdomain() - nscd = ipaservices.knownservices.nscd - nslcd = ipaservices.knownservices.nslcd + nscd = services.knownservices.nscd + nslcd = services.knownservices.nslcd for service in (nscd, nslcd): if service.is_installed(): @@ -686,16 +686,16 @@ def uninstall(options, env): pass if not ntp_enabled: - ipaservices.knownservices.ntpd.stop() - ipaservices.knownservices.ntpd.disable() + services.knownservices.ntpd.stop() + services.knownservices.ntpd.disable() else: if restored: - ipaservices.knownservices.ntpd.restart() + services.knownservices.ntpd.restart() ipaclient.ntpconf.restore_forced_ntpd(statestore) - if was_sshd_configured and ipaservices.knownservices.sshd.is_running(): - ipaservices.knownservices.sshd.restart() + if was_sshd_configured and services.knownservices.sshd.is_running(): + services.knownservices.sshd.restart() # Remove the Firefox configuration if statestore.has_state('firefox'): @@ -890,7 +890,7 @@ def configure_nslcd_conf(fstore, cli_basedn, cli_realm, cli_domain, cli_server, root_logger.error("Creation of %s failed: %s", filename, str(e)) return (1, None, None) - nslcd = ipaservices.knownservices.nslcd + nslcd = services.knownservices.nslcd if nslcd.is_installed(): try: nslcd.restart() @@ -1067,7 +1067,7 @@ def configure_certmonger(fstore, subject_base, cli_realm, hostname, options, started = True principal = 'host/%s@%s' % (hostname, cli_realm) - messagebus = ipaservices.knownservices.messagebus + messagebus = services.knownservices.messagebus try: messagebus.start() except Exception, e: @@ -1075,7 +1075,7 @@ def configure_certmonger(fstore, subject_base, cli_realm, hostname, options, # Ensure that certmonger has been started at least once to generate the # cas files in /var/lib/certmonger/cas. - cmonger = ipaservices.knownservices.certmonger + cmonger = services.knownservices.certmonger try: cmonger.restart() except Exception, e: @@ -1172,7 +1172,7 @@ def configure_sssd_conf(fstore, cli_realm, cli_domain, cli_server, options, clie sssdconfig.new_config() domain = sssdconfig.new_domain(cli_domain) - ssh_dir = ipaservices.knownservices.sshd.get_config_dir() + ssh_dir = services.knownservices.sshd.get_config_dir() ssh_config = os.path.join(ssh_dir, 'ssh_config') sshd_config = os.path.join(ssh_dir, 'sshd_config') @@ -1314,7 +1314,7 @@ def change_ssh_config(filename, changes, sections): return True def configure_ssh_config(fstore, options): - ssh_dir = ipaservices.knownservices.sshd.get_config_dir() + ssh_dir = services.knownservices.sshd.get_config_dir() ssh_config = os.path.join(ssh_dir, 'ssh_config') if not file_exists(ssh_config): @@ -1338,7 +1338,7 @@ def configure_ssh_config(fstore, options): root_logger.info('Configured %s', ssh_config) def configure_sshd_config(fstore, options): - sshd = ipaservices.knownservices.sshd + sshd = services.knownservices.sshd ssh_dir = sshd.get_config_dir() sshd_config = os.path.join(ssh_dir, 'sshd_config') @@ -1440,14 +1440,14 @@ def configure_nisdomain(options, domain): # Backup the state of the domainname service statestore.backup_state("domainname", "enabled", - ipaservices.knownservices.domainname.is_enabled()) + services.knownservices.domainname.is_enabled()) # Set the new NIS domain name tasks.set_nisdomain(domain) # Enable and start the domainname service - ipaservices.knownservices.domainname.enable() - ipaservices.knownservices.domainname.start() + services.knownservices.domainname.enable() + services.knownservices.domainname.start() def unconfigure_nisdomain(): @@ -1465,7 +1465,7 @@ def unconfigure_nisdomain(): # Restore the configuration of the domainname service enabled = statestore.restore_state('domainname', 'enabled') if not enabled: - ipaservices.knownservices.domainname.disable() + services.knownservices.domainname.disable() def resolve_ipaddress(server): @@ -2640,7 +2640,7 @@ def install(options, env, fstore, statestore): configure_certmonger(fstore, subject_base, cli_realm, hostname, options, remote_env) - update_ssh_keys(cli_server[0], hostname, ipaservices.knownservices.sshd.get_config_dir(), options.create_sshfp) + update_ssh_keys(cli_server[0], hostname, services.knownservices.sshd.get_config_dir(), options.create_sshfp) try: os.remove(CCACHE_FILE) @@ -2648,7 +2648,7 @@ def install(options, env, fstore, statestore): pass #Name Server Caching Daemon. Disable for SSSD, use otherwise (if installed) - nscd = ipaservices.knownservices.nscd + nscd = services.knownservices.nscd if nscd.is_installed(): save_state(nscd) @@ -2689,7 +2689,7 @@ def install(options, env, fstore, statestore): root_logger.info("%s daemon is not installed, skip configuration", nscd.service_name) - nslcd = ipaservices.knownservices.nslcd + nslcd = services.knownservices.nslcd if nscd.is_installed(): save_state(nslcd) @@ -2704,7 +2704,7 @@ def install(options, env, fstore, statestore): root_logger.info("%s enabled", "SSSD" if options.sssd else "LDAP") if options.sssd: - sssd = ipaservices.service('sssd') + sssd = services.service('sssd') try: sssd.restart() except CalledProcessError: diff --git a/ipa-client/ipaclient/ntpconf.py b/ipa-client/ipaclient/ntpconf.py index 9a68016e5..182c977d2 100644 --- a/ipa-client/ipaclient/ntpconf.py +++ b/ipa-client/ipaclient/ntpconf.py @@ -22,6 +22,7 @@ from ipapython import services as ipaservices import shutil import os from ipaplatform import tasks +from ipaplatform import services ntp_conf = """# Permit time synchronization with our time source, but do not # permit the source to query or modify the service on this system. @@ -115,7 +116,7 @@ def config_ntp(server_fqdn, fstore = None, sysstore = None): if sysstore: module = 'ntp' - sysstore.backup_state(module, "enabled", ipaservices.knownservices.ntpd.is_enabled()) + sysstore.backup_state(module, "enabled", services.knownservices.ntpd.is_enabled()) if config_step_tickers: sysstore.backup_state(module, "step-tickers", True) @@ -128,10 +129,10 @@ def config_ntp(server_fqdn, fstore = None, sysstore = None): tasks.restore_context(path_ntp_sysconfig) # Set the ntpd to start on boot - ipaservices.knownservices.ntpd.enable() + services.knownservices.ntpd.enable() # Restart ntpd - ipaservices.knownservices.ntpd.restart() + services.knownservices.ntpd.restart() def synconce_ntp(server_fqdn): @@ -174,11 +175,11 @@ def check_timedate_services(): https://fedorahosted.org/freeipa/ticket/2974 http://fedoraproject.org/wiki/Features/ChronyDefaultNTP """ - for service in ipaservices.timedate_services: + for service in services.timedate_services: if service == 'ntpd': continue # Make sure that the service is not enabled - service = ipaservices.service(service) + service = services.service(service) if service.is_enabled() or service.is_running(): raise NTPConflictingService(conflicting_service=service.service_name) @@ -187,10 +188,10 @@ def force_ntpd(statestore): Force ntpd configuration and disable and stop any other conflicting time&date service """ - for service in ipaservices.timedate_services: + for service in services.timedate_services: if service == 'ntpd': continue - service = ipaservices.service(service) + service = services.service(service) enabled = service.is_enabled() running = service.is_running() @@ -209,11 +210,11 @@ def restore_forced_ntpd(statestore): Restore from --force-ntpd installation and enable/start service that were disabled/stopped during installation """ - for service in ipaservices.timedate_services: + for service in services.timedate_services: if service == 'ntpd': continue if statestore.has_state(service): - service = ipaservices.service(service) + service = services.service(service) enabled = statestore.restore_state(service.service_name, 'enabled') running = statestore.restore_state(service.service_name, 'running') if enabled: |