diff options
author | Tomas Babej <tbabej@redhat.com> | 2014-05-29 10:37:18 +0200 |
---|---|---|
committer | Petr Viktorin <pviktori@redhat.com> | 2014-06-16 19:48:19 +0200 |
commit | 49fcd42f8fd71b894a0953a37f10a6c326e16048 (patch) | |
tree | 0c1324c5a3183ce20e92af183ffefde92a77147a /install | |
parent | 926f8647d2a676c1dd2e446633eb76cdf1a7bf0c (diff) | |
download | freeipa-49fcd42f8fd71b894a0953a37f10a6c326e16048.tar.gz freeipa-49fcd42f8fd71b894a0953a37f10a6c326e16048.tar.xz freeipa-49fcd42f8fd71b894a0953a37f10a6c326e16048.zip |
ipaplatform: Change service code in freeipa to use ipaplatform services
https://fedorahosted.org/freeipa/ticket/4052
Reviewed-By: Petr Viktorin <pviktori@redhat.com>
Diffstat (limited to 'install')
-rw-r--r-- | install/restart_scripts/renew_ca_cert | 5 | ||||
-rw-r--r-- | install/restart_scripts/renew_ra_cert | 3 | ||||
-rw-r--r-- | install/restart_scripts/restart_dirsrv | 3 | ||||
-rw-r--r-- | install/restart_scripts/restart_httpd | 3 | ||||
-rw-r--r-- | install/restart_scripts/stop_pkicad | 3 | ||||
-rwxr-xr-x | install/share/copy-schema-to-ca.py | 3 | ||||
-rwxr-xr-x | install/tools/ipa-ca-install | 3 | ||||
-rwxr-xr-x | install/tools/ipa-nis-manage | 5 | ||||
-rwxr-xr-x | install/tools/ipa-replica-install | 5 | ||||
-rwxr-xr-x | install/tools/ipa-server-install | 7 | ||||
-rwxr-xr-x | install/tools/ipactl | 25 |
11 files changed, 38 insertions, 27 deletions
diff --git a/install/restart_scripts/renew_ca_cert b/install/restart_scripts/renew_ca_cert index 2663887d6..550de969a 100644 --- a/install/restart_scripts/renew_ca_cert +++ b/install/restart_scripts/renew_ca_cert @@ -32,6 +32,7 @@ from ipapython import services as ipaservices from ipalib import api, errors, x509, util from ipaserver.install import certs, cainstance, installutils from ipaserver.plugins.ldap2 import ldap2 +from ipaplatform import services def main(): nickname = sys.argv[1] @@ -41,7 +42,7 @@ def main(): configured_constants = dogtag.configured_constants(api) alias_dir = configured_constants.ALIAS_DIR - dogtag_service = ipaservices.knownservices[configured_constants.SERVICE_NAME] + dogtag_service = services.knownservices[configured_constants.SERVICE_NAME] dogtag_instance = configured_constants.PKI_INSTANCE_NAME # dogtag opens its NSS database in read/write mode so we need it @@ -89,7 +90,7 @@ def main(): "Updating trust on certificate %s failed in %s" % (nickname, db.secdir)) - # Now we can start the CA. Using the ipaservices start should fire + # Now we can start the CA. Using the services start should fire # off the servlet to verify that the CA is actually up and responding so # when this returns it should be good-to-go. The CA was stopped in the # pre-save state. diff --git a/install/restart_scripts/renew_ra_cert b/install/restart_scripts/renew_ra_cert index 79bc4cf58..46367fd9c 100644 --- a/install/restart_scripts/renew_ra_cert +++ b/install/restart_scripts/renew_ra_cert @@ -27,6 +27,7 @@ import traceback from ipapython import services as ipaservices from ipalib import api from ipaserver.install import certs, cainstance +from ipaplatform import services nickname = 'ipaCert' @@ -49,7 +50,7 @@ def main(): # Now restart Apache so the new certificate is available syslog.syslog(syslog.LOG_NOTICE, "Restarting httpd") try: - ipaservices.knownservices.httpd.restart() + services.knownservices.httpd.restart() except Exception, e: syslog.syslog(syslog.LOG_ERR, "Cannot restart httpd: %s" % e) else: diff --git a/install/restart_scripts/restart_dirsrv b/install/restart_scripts/restart_dirsrv index 03e6a5c42..738bb3120 100644 --- a/install/restart_scripts/restart_dirsrv +++ b/install/restart_scripts/restart_dirsrv @@ -24,6 +24,7 @@ import syslog import traceback from ipapython import services as ipaservices from ipalib import api +from ipaplatform import services def main(): try: @@ -37,7 +38,7 @@ def main(): syslog.syslog(syslog.LOG_NOTICE, "certmonger restarted dirsrv instance '%s'" % instance) try: - ipaservices.knownservices.dirsrv.restart(instance) + services.knownservices.dirsrv.restart(instance) except Exception, e: syslog.syslog(syslog.LOG_ERR, "Cannot restart dirsrv (instance: '%s'): %s" % (instance, str(e))) diff --git a/install/restart_scripts/restart_httpd b/install/restart_scripts/restart_httpd index 98337bc85..e8ff72824 100644 --- a/install/restart_scripts/restart_httpd +++ b/install/restart_scripts/restart_httpd @@ -22,12 +22,13 @@ import syslog import traceback from ipapython import services as ipaservices +from ipaplatform import services def main(): syslog.syslog(syslog.LOG_NOTICE, 'certmonger restarted httpd') try: - ipaservices.knownservices.httpd.restart() + services.knownservices.httpd.restart() except Exception, e: syslog.syslog(syslog.LOG_ERR, "Cannot restart httpd: %s" % str(e)) diff --git a/install/restart_scripts/stop_pkicad b/install/restart_scripts/stop_pkicad index e58e04401..461baa6a5 100644 --- a/install/restart_scripts/stop_pkicad +++ b/install/restart_scripts/stop_pkicad @@ -25,13 +25,14 @@ import traceback from ipapython import services as ipaservices from ipapython import dogtag from ipalib import api +from ipaplatform import services def main(): api.bootstrap(context='restart') api.finalize() configured_constants = dogtag.configured_constants(api) - dogtag_service = ipaservices.knownservices[configured_constants.SERVICE_NAME] + dogtag_service = services.knownservices[configured_constants.SERVICE_NAME] dogtag_instance = configured_constants.PKI_INSTANCE_NAME syslog.syslog(syslog.LOG_NOTICE, "Stopping %s" % dogtag_service.service_name) diff --git a/install/share/copy-schema-to-ca.py b/install/share/copy-schema-to-ca.py index a5646cd6b..68f7dfdbd 100755 --- a/install/share/copy-schema-to-ca.py +++ b/install/share/copy-schema-to-ca.py @@ -15,7 +15,8 @@ import sys import pwd import shutil -from ipapython import services, ipautil, dogtag +from ipaplatform import services +from ipapython import ipautil, dogtag from ipapython.ipa_log_manager import root_logger, standard_logging_setup from ipaserver.install.dsinstance import DS_USER, schema_dirname from ipaserver.install.cainstance import PKI_USER diff --git a/install/tools/ipa-ca-install b/install/tools/ipa-ca-install index 18c81dc1f..630c83815 100755 --- a/install/tools/ipa-ca-install +++ b/install/tools/ipa-ca-install @@ -40,6 +40,7 @@ from ipapython.config import IPAOptionParser from ipapython import sysrestore from ipapython import dogtag from ipapython.ipa_log_manager import * +from ipaplatform import services log_file_name = "/var/log/ipareplica-ca-install.log" REPLICA_INFO_TOP_DIR = None @@ -190,7 +191,7 @@ def main(): install_dns_records(config, options) # We need to restart apache as we drop a new config file in there - ipaservices.knownservices.httpd.restart(capture_output=True) + services.knownservices.httpd.restart(capture_output=True) #update dogtag version in config file try: diff --git a/install/tools/ipa-nis-manage b/install/tools/ipa-nis-manage index 229b6b02d..b37cd6594 100755 --- a/install/tools/ipa-nis-manage +++ b/install/tools/ipa-nis-manage @@ -31,6 +31,7 @@ try: from ipalib import api, errors from ipapython.ipa_log_manager import * from ipapython.dn import DN + from ipaplatform import services except ImportError: print >> sys.stderr, """\ There was a problem importing one of the required Python modules. The @@ -142,13 +143,13 @@ def main(): # Enable either the portmap or rpcbind service try: - portmap = ipaservices.knownservices.portmap + portmap = services.knownservices.portmap portmap.enable() servicemsg = portmap.service_name except ipautil.CalledProcessError, cpe: if cpe.returncode == 1: try: - rpcbind = ipaservices.knownservices.rpcbind + rpcbind = services.knownservices.rpcbind rpcbind.enable() servicemsg = rpcbind.service_name except ipautil.CalledProcessError, cpe: diff --git a/install/tools/ipa-replica-install b/install/tools/ipa-replica-install index 9452c6fcb..1c0488e5f 100755 --- a/install/tools/ipa-replica-install +++ b/install/tools/ipa-replica-install @@ -52,6 +52,7 @@ from ipapython import dogtag from ipapython.dn import DN import ipaclient.ntpconf from ipaplatform import tasks +from ipaplatform import services log_file_name = "/var/log/ipareplica-install.log" REPLICA_INFO_TOP_DIR = None @@ -698,7 +699,7 @@ def main(): CA.configure_certmonger_renewal() CA.import_ra_cert(dir + "/ra.p12") CA.fix_ra_perms() - ipaservices.knownservices.httpd.restart() + services.knownservices.httpd.restart() # The DS instance is created before the keytab, add the SSL cert we # generated @@ -748,7 +749,7 @@ def main(): ds.replica_populate() #Everything installed properly, activate ipa service. - ipaservices.knownservices.ipa.enable() + services.knownservices.ipa.enable() fail_message = ''' Your system may be partly configured. diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install index 00614b64e..19a0bab94 100755 --- a/install/tools/ipa-server-install +++ b/install/tools/ipa-server-install @@ -79,6 +79,7 @@ from ipapython.dn import DN import ipaclient.ntpconf from ipaplatform import tasks +from ipaplatform import services uninstalling = False installation_cleanup = True @@ -521,7 +522,7 @@ def uninstall(): group_exists = sstore.restore_state("install", "group_exists") - ipaservices.knownservices.ipa.disable() + services.knownservices.ipa.disable() ipautil.restore_hostname(sstore) @@ -1218,7 +1219,7 @@ def main(): #Everything installed properly, activate ipa service. - ipaservices.knownservices.ipa.enable() + services.knownservices.ipa.enable() print "==============================================================================" print "Setup complete" @@ -1242,7 +1243,7 @@ def main(): print "\t This ticket will allow you to use the IPA tools (e.g., ipa user-add)" print "\t and the web user interface." - if not ipaservices.knownservices.ntpd.is_running(): + if not services.knownservices.ntpd.is_running(): print "\t3. Kerberos requires time synchronization between clients" print "\t and servers for correct operation. You should consider enabling ntpd." diff --git a/install/tools/ipactl b/install/tools/ipactl index 77e6ebd7e..581aacc36 100755 --- a/install/tools/ipactl +++ b/install/tools/ipactl @@ -34,6 +34,7 @@ from ipapython import services as ipaservices from ipapython import config, dogtag from ipaplatform import tasks from ipapython.dn import DN +from ipaplatform import services class IpactlError(ScriptError): pass @@ -196,7 +197,7 @@ def get_config_from_file(): def stop_services(svc_list): for svc in svc_list: - svc_off = ipaservices.service(svc) + svc_off = services.service(svc) try: svc_off.stop(capture_output=False) except Exception: @@ -222,7 +223,7 @@ def ipa_start(options): # service file again os.unlink(ipaservices.SVC_LIST_FILE) - dirsrv = ipaservices.knownservices.dirsrv + dirsrv = services.knownservices.dirsrv try: print "Starting Directory Service" dirsrv.start(capture_output=get_capture_output('dirsrv', options.debug)) @@ -250,7 +251,7 @@ def ipa_start(options): return for svc in svc_list: - svchandle = ipaservices.service(svc) + svchandle = services.service(svc) try: print "Starting %s Service" % svc svchandle.start(capture_output=get_capture_output(svc, options.debug)) @@ -268,7 +269,7 @@ def ipa_start(options): raise IpactlError("Aborting ipactl") def ipa_stop(options): - dirsrv = ipaservices.knownservices.dirsrv + dirsrv = services.knownservices.dirsrv try: svc_list = get_config_from_file() except Exception, e: @@ -293,7 +294,7 @@ def ipa_stop(options): raise IpactlError("Failed to stop Directory Service") for svc in reversed(svc_list): - svchandle = ipaservices.service(svc) + svchandle = services.service(svc) try: print "Stopping %s Service" % svc svchandle.stop(capture_output=False) @@ -308,7 +309,7 @@ def ipa_stop(options): def ipa_restart(options): - dirsrv = ipaservices.knownservices.dirsrv + dirsrv = services.knownservices.dirsrv new_svc_list = [] dirsrv_restart = True if not dirsrv.is_running(): @@ -359,7 +360,7 @@ def ipa_restart(options): if len(old_svc_list) != 0: # we need to definitely stop some services for svc in reversed(old_svc_list): - svchandle = ipaservices.service(svc) + svchandle = services.service(svc) try: print "Stopping %s Service" % svc svchandle.stop(capture_output=False) @@ -384,7 +385,7 @@ def ipa_restart(options): # there are services to restart for svc in svc_list: - svchandle = ipaservices.service(svc) + svchandle = services.service(svc) try: print "Restarting %s Service" % svc svchandle.restart(capture_output=get_capture_output(svc, options.debug)) @@ -404,7 +405,7 @@ def ipa_restart(options): if len(new_svc_list) != 0: # we still need to start some services for svc in new_svc_list: - svchandle = ipaservices.service(svc) + svchandle = services.service(svc) try: print "Starting %s Service" % svc svchandle.start(capture_output=get_capture_output(svc, options.debug)) @@ -424,7 +425,7 @@ def ipa_restart(options): def ipa_status(options): try: - dirsrv = ipaservices.knownservices.dirsrv + dirsrv = services.knownservices.dirsrv if dirsrv.is_running(): svc_list = get_config(dirsrv) else: @@ -437,7 +438,7 @@ def ipa_status(options): except Exception, e: raise IpactlError("Failed to get list of services to probe status: " + str(e)) - dirsrv = ipaservices.knownservices.dirsrv + dirsrv = services.knownservices.dirsrv try: if dirsrv.is_running(): print "Directory Service: RUNNING" @@ -453,7 +454,7 @@ def ipa_status(options): return for svc in svc_list: - svchandle = ipaservices.service(svc) + svchandle = services.service(svc) try: if svchandle.is_running(): print "%s Service: RUNNING" % svc |