summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
Diffstat (limited to 'install')
-rwxr-xr-xinstall/tools/ipa-ca-install4
-rwxr-xr-xinstall/tools/ipa-nis-manage13
-rwxr-xr-xinstall/tools/ipa-replica-install13
-rwxr-xr-xinstall/tools/ipa-server-install11
-rwxr-xr-xinstall/tools/ipactl43
5 files changed, 50 insertions, 34 deletions
diff --git a/install/tools/ipa-ca-install b/install/tools/ipa-ca-install
index 05a05dc..4538774 100755
--- a/install/tools/ipa-ca-install
+++ b/install/tools/ipa-ca-install
@@ -24,6 +24,7 @@ import socket
import os, traceback, logging, shutil
from ipapython import ipautil
+from ipapython import services as ipaservices
from ipaserver.install import installutils, service
from ipaserver.install import certs
@@ -36,7 +37,6 @@ from ipapython import version
from ipalib import api, util
from ipapython.config import IPAOptionParser
from ipapython import sysrestore
-from ipapython import ipautil
CACERT="/etc/ipa/ca.crt"
REPLICA_INFO_TOP_DIR=None
@@ -146,7 +146,7 @@ def main():
cs.add_cert_to_service()
# We need to restart apache as we drop a new config file in there
- ipautil.service_restart('httpd', '', True)
+ ipaservices.knownservices.httpd.restart(capture_output=True)
try:
if not os.geteuid()==0:
diff --git a/install/tools/ipa-nis-manage b/install/tools/ipa-nis-manage
index d875f96..542736a 100755
--- a/install/tools/ipa-nis-manage
+++ b/install/tools/ipa-nis-manage
@@ -24,6 +24,7 @@ import os
try:
from optparse import OptionParser
from ipapython import ipautil, config
+ from ipapython import services as ipaservices
from ipaserver.install import installutils
from ipaserver.install.ldapupdate import LDAPUpdate, BadSyntax
from ipaserver.plugins.ldap2 import ldap2
@@ -143,15 +144,17 @@ def main():
# Enable either the portmap or rpcbind service
try:
- ipautil.run(["/sbin/chkconfig", "portmap", "on"])
- servicemsg = "portmap"
+ portmap = ipaservices.knownservices.portmap
+ portmap.enable()
+ servicemsg = portmap.service_name
except ipautil.CalledProcessError, cpe:
if cpe.returncode == 1:
try:
- ipautil.run(["/sbin/chkconfig", "rpcbind", "on"])
- servicemsg = "rpcbind"
+ rpcbind = ipaservices.knownservices.rpcbind
+ rpcbind.enable()
+ servicemsg = rpcbind.service_name
except ipautil.CalledProcessError, cpe:
- print "Unable to enable either portmap or 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 29cbc0a..7b01f76 100755
--- a/install/tools/ipa-replica-install
+++ b/install/tools/ipa-replica-install
@@ -39,6 +39,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
@@ -261,7 +262,7 @@ def check_dirsrv():
sys.exit(1)
try:
- service.stop("dirsrv")
+ ipaservices.knownservices.dirsrv.stop()
except:
pass
@@ -444,7 +445,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
@@ -454,9 +455,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)
@@ -473,7 +474,7 @@ def main():
ds.init_memberof()
#Everything installed properly, activate ipa service.
- service.chkconfig_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 0572d4f..e9f2c75 100755
--- a/install/tools/ipa-server-install
+++ b/install/tools/ipa-server-install
@@ -63,6 +63,7 @@ from ipapython.config import IPAOptionParser
from ipalib.dn import DN
from ipalib.x509 import load_certificate_from_file, load_certificate_chain_from_file
from ipalib.constants import DNS_ZONE_REFRESH
+from ipapython import services as ipaservices
pw_name = None
uninstalling = False
@@ -438,7 +439,7 @@ def check_dirsrv(unattended):
sys.exit(1)
try:
- service.stop("dirsrv")
+ ipaservices.knownservices.dirsrv.stop()
except:
pass
@@ -510,7 +511,7 @@ def uninstall():
except KeyError:
logging.info("Group %s already removed", dsinstance.DS_GROUP)
- service.chkconfig_off('ipa')
+ ipaservices.knownservices.ipa.disable()
# Now for some sanity checking. Make sure everything was really
# uninstalled.
@@ -999,7 +1000,7 @@ def main():
os.remove(pw_name)
else:
http.create_instance(realm_name, host_name, domain_name, dm_password, autoconfig=True, self_signed_ca=options.selfsign, subject_base=options.subject, auto_redirect=options.ui_redirect)
- ipautil.run(["/sbin/restorecon", "/var/cache/ipa/sessions"])
+ ipaservices.restore_context("/var/cache/ipa/sessions")
set_subject_in_config(realm_name, dm_password, util.realm_to_suffix(realm_name), options.subject)
@@ -1043,7 +1044,7 @@ def main():
#Everything installed properly, activate ipa service.
- service.chkconfig_on('ipa')
+ ipaservices.knownservices.ipa.enable()
print "=============================================================================="
print "Setup complete"
@@ -1067,7 +1068,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 f7b2adc..cab11c9 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 ipaserver.install.installutils import is_ipa_configured
from ipapython import sysrestore
@@ -161,9 +162,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))
@@ -174,7 +176,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):
@@ -189,25 +191,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()
@@ -216,14 +221,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)
@@ -233,23 +238,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))
@@ -260,7 +267,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):
@@ -275,27 +282,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"
@@ -315,8 +325,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