diff options
-rwxr-xr-x | install/tools/ipa-nis-manage | 12 | ||||
-rwxr-xr-x | install/tools/ipa-replica-install | 15 | ||||
-rwxr-xr-x | install/tools/ipa-server-install | 10 | ||||
-rwxr-xr-x | install/tools/ipactl | 43 |
4 files changed, 47 insertions, 33 deletions
diff --git a/install/tools/ipa-nis-manage b/install/tools/ipa-nis-manage index ca1505d2b..542736a8d 100755 --- a/install/tools/ipa-nis-manage +++ b/install/tools/ipa-nis-manage @@ -144,15 +144,17 @@ def main(): # Enable either the portmap or rpcbind service try: - ipaservices.service_on(ipaservices.SERVICE_PORTMAP) - servicemsg = ipaservices.SERVICE_PORTMAP + portmap = ipaservices.knownservices.portmap + portmap.enable() + servicemsg = portmap.service_name except ipautil.CalledProcessError, cpe: if cpe.returncode == 1: try: - ipaservices.service_on(ipaservices.SERVICE_RPCBIND) - servicemsg = ipaservices.SERVICE_RPCBIND + rpcbind = ipaservices.knownservices.rpcbind + rpcbind.enable() + servicemsg = rpcbind.service_name except ipautil.CalledProcessError, cpe: - print "Unable to enable either %s or %s" % (ipaservices.SERVICE_PORTMAP, ipaservices.SERVICE_RPCBIND) + print "Unable to enable either %s or %s" % (portmap.service_name, rpcbind.service_name) retval = 3 # The cn=config entry for the plugin may already exist but it diff --git a/install/tools/ipa-replica-install b/install/tools/ipa-replica-install index e8c3fb59a..2072b25b4 100755 --- a/install/tools/ipa-replica-install +++ b/install/tools/ipa-replica-install @@ -38,6 +38,7 @@ from ipapython import version from ipalib import api, errors, util from ipapython.config import IPAOptionParser from ipapython import sysrestore +from ipapython import services as ipaservices CACERT="/etc/ipa/ca.crt" REPLICA_INFO_TOP_DIR=None @@ -250,8 +251,8 @@ def check_dirsrv(): print "server, the one used by IPA itself." sys.exit(1) - try: - service.stop("dirsrv") + try: + ipaservices.knownservices.dirsrv.stop() except: pass @@ -434,7 +435,7 @@ def main(): if CA: CA.import_ra_cert(dir + "/ra.p12") CA.fix_ra_perms() - service.restart("httpd") + ipaservices.knownservices.httpd.restart() # The DS instance is created before the keytab, add the SSL cert we # generated @@ -444,9 +445,9 @@ def main(): service.print_msg("Applying LDAP updates") ds.apply_updates() - service.restart("dirsrv") - service.restart("krb5kdc") - service.restart("httpd") + ipaservices.knownservices.dirsrv.restart() + ipaservices.knownservices.krb5kdc.restart() + ipaservices.knownservices.httpd.restart() if options.setup_dns: install_bind(config, options) @@ -463,7 +464,7 @@ def main(): ds.init_memberof() #Everything installed properly, activate ipa service. - service.service_on('ipa') + ipaservices.knownservices.ipa.enable() try: if not os.geteuid()==0: diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install index 187885b7c..41791c823 100755 --- a/install/tools/ipa-server-install +++ b/install/tools/ipa-server-install @@ -56,12 +56,12 @@ from ipaserver.plugins.ldap2 import ldap2 from ipapython import sysrestore from ipapython.ipautil import * -import ipapython.services as ipaservices from ipalib import api, errors, util from ipalib.parameters import IA5Str from ipapython.config import IPAOptionParser from ipalib.dn import DN from ipalib.x509 import load_certificate_from_file, load_certificate_chain_from_file +from ipapython import services as ipaservices pw_name = None uninstalling = False @@ -410,7 +410,7 @@ def check_dirsrv(unattended): sys.exit(1) try: - service.stop("dirsrv") + ipaservices.knownservices.dirsrv.stop() except: pass @@ -478,7 +478,7 @@ def uninstall(): except KeyError: logging.info("Group %s already removed", dsinstance.DS_GROUP) - service.service_off('ipa') + ipaservices.knownservices.ipa.disable() return 0 @@ -989,7 +989,7 @@ def main(): #Everything installed properly, activate ipa service. - service.service_on('ipa') + ipaservices.knownservices.ipa.enable() print "==============================================================================" print "Setup complete" @@ -1013,7 +1013,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 service.is_running("ntpd"): + if not ipaservices.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 313b87662..fd740ac98 100755 --- a/install/tools/ipactl +++ b/install/tools/ipactl @@ -22,6 +22,7 @@ import sys try: import os from ipaserver.install import service + from ipapython import services as ipaservices from ipaserver.install.dsinstance import config_dirname, realm_to_serverid from ipapython import sysrestore from ipapython import config @@ -160,9 +161,10 @@ def get_config(): return svc_list def ipa_start(options): + dirsrv = ipaservices.knownservices.dirsrv try: print "Starting Directory Service" - service.start('dirsrv', capture_output=get_capture_output('dirsrv', options.debug)) + dirsrv.start(capture_output=get_capture_output('dirsrv', options.debug)) except Exception, e: raise IpactlError("Failed to start Directory Service: " + str(e)) @@ -173,7 +175,7 @@ def ipa_start(options): emit_err("Failed to read data from Directory Service: " + str(e)) emit_err("Shutting down") try: - service.stop('dirsrv', capture_output=False) + dirsrv.stop(capture_output=False) except: pass if isinstance(e, IpactlError): @@ -188,25 +190,28 @@ def ipa_start(options): for (order, svc) in sorted(svc_list): svc_name = service.SERVICE_LIST[svc][0] + svchandle = ipaservices.service(svc_name) try: print "Starting %s Service" % svc - service.start(svc_name, capture_output=get_capture_output(svc_name, options.debug)) + svchandle.start(capture_output=get_capture_output(svc_name, options.debug)) except: emit_err("Failed to start %s Service" % svc) emit_err("Shutting down") for (order, svc) in sorted(svc_list): svc_name = service.SERVICE_LIST[svc][0] + svc_off = ipaservices.service(svc_name) try: - service.stop(svc_name, capture_output=False) + svc_off.stop(capture_output=False) except: pass try: - service.stop('dirsrv', capture_output=False) + svchandle.stop('dirsrv', capture_output=False) except: pass raise IpactlError("Aborting ipactl") def ipa_stop(options): + dirsrv = ipaservices.knownservices.dirsrv svc_list = [] try: svc_list = get_config() @@ -215,14 +220,14 @@ def ipa_stop(options): # and see if we can get anything. If not throw our hands up and just # exit try: - service.start('dirsrv', capture_output=False) + dirsrv.start(capture_output=False) svc_list = get_config() except Exception, e: emit_err("Failed to read data from Directory Service: " + str(e)) emit_err("Shutting down") try: # just try to stop it, do not read a result - service.stop('dirsrv') + dirsrv.stop() finally: raise IpactlError(None) @@ -232,23 +237,25 @@ def ipa_stop(options): for (order, svc) in sorted(svc_list, reverse=True): svc_name = service.SERVICE_LIST[svc][0] + svchandle = ipaservices.service(svc_name) try: print "Stopping %s Service" % svc - service.stop(svc_name, capture_output=False) + svchandle.stop(capture_output=False) except: emit_err("Failed to stop %s Service" % svc) try: print "Stopping Directory Service" - service.stop('dirsrv', capture_output=False) + dirsrv.stop('dirsrv', capture_output=False) except: raise IpactlError("Failed to stop Directory Service") def ipa_restart(options): + dirsrv = ipaservices.knownservices.dirsrv try: print "Restarting Directory Service" - service.restart('dirsrv', capture_output=get_capture_output('dirsrv', options.debug)) + dirsrv.restart(capture_output=get_capture_output('dirsrv', options.debug)) except Exception, e: raise IpactlError("Failed to restart Directory Service: " + str(e)) @@ -259,7 +266,7 @@ def ipa_restart(options): emit_err("Failed to read data from Directory Service: " + str(e)) emit_err("Shutting down") try: - service.stop('dirsrv', capture_output=False) + dirsrv.stop(capture_output=False) except: pass if isinstance(e, IpactlError): @@ -274,27 +281,30 @@ def ipa_restart(options): for (order, svc) in sorted(svc_list): svc_name = service.SERVICE_LIST[svc][0] + svchandle = ipaservices.service(svc_name) try: print "Restarting %s Service" % svc - service.restart(svc_name, capture_output=get_capture_output(svc_name, options.debug)) + svchandle.restart(capture_output=get_capture_output(svc_name, options.debug)) except: emit_err("Failed to restart %s Service" % svc) emit_err("Shutting down") for (order, svc) in sorted(svc_list): svc_name = service.SERVICE_LIST[svc][0] + svc_off = ipaservices.service(svc_name) try: - service.stop(svc_name, capture_output=False) + svc_off.stop(capture_output=False) except: pass try: - service.stop('dirsrv', capture_output=False) + dirsrv.stop(capture_output=False) except: pass raise IpactlError("Aborting ipactl") def ipa_status(options): + dirsrv = ipaservices.knownservices.dirsrv try: - if service.is_running('dirsrv'): + if dirsrv.is_running(): print "Directory Service: RUNNING" else: print "Directory Service: STOPPED" @@ -314,8 +324,9 @@ def ipa_status(options): for (order, svc) in sorted(svc_list): svc_name = service.SERVICE_LIST[svc][0] + svchandle = ipaservices.service(svc_name) try: - if service.is_running(svc_name): + if svchandle.is_running(): print "%s Service: RUNNING" % svc else: print "%s Service: STOPPED" % svc |