summaryrefslogtreecommitdiffstats
path: root/ipaserver
diff options
context:
space:
mode:
authorAlexander Bokovoy <abokovoy@redhat.com>2011-07-20 20:20:22 +0300
committerAlexander Bokovoy <abokovoy@redhat.com>2011-08-30 11:41:03 +0300
commitfeb01f4186dd76d2f9fc65d14f19ed73bea351eb (patch)
treecd2acf87fb645e9f37f3ec040b2bffdc0ac8c1cf /ipaserver
parent28e6d137afa65f638ea6e748eb39bce9aa83e403 (diff)
downloadfreeipa-feb01f4186dd76d2f9fc65d14f19ed73bea351eb.tar.gz
freeipa-feb01f4186dd76d2f9fc65d14f19ed73bea351eb.tar.xz
freeipa-feb01f4186dd76d2f9fc65d14f19ed73bea351eb.zip
First phase of iputil refactoring: introduce ipapython.services and ipapython.platform
Diffstat (limited to 'ipaserver')
-rw-r--r--ipaserver/install/bindinstance.py2
-rw-r--r--ipaserver/install/cainstance.py4
-rw-r--r--ipaserver/install/certs.py2
-rw-r--r--ipaserver/install/dsinstance.py6
-rw-r--r--ipaserver/install/httpinstance.py2
-rw-r--r--ipaserver/install/krbinstance.py2
-rw-r--r--ipaserver/install/ntpinstance.py4
-rw-r--r--ipaserver/install/service.py55
8 files changed, 39 insertions, 38 deletions
diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index 676b1a476..7f7d67b41 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -608,7 +608,7 @@ class BindInstance(service.Service):
pass
if not enabled is None and not enabled:
- self.chkconfig_off()
+ self.service_off()
if not running is None and running:
self.start()
diff --git a/ipaserver/install/cainstance.py b/ipaserver/install/cainstance.py
index 5c6c49e4b..a5b5500e1 100644
--- a/ipaserver/install/cainstance.py
+++ b/ipaserver/install/cainstance.py
@@ -397,7 +397,7 @@ class CADSInstance(service.Service):
self.stop(serverid)
if not enabled is None and not enabled:
- self.chkconfig_off()
+ self.service_off()
if not serverid is None:
# drop the trailing / off the config_dirname so the directory
@@ -1054,7 +1054,7 @@ class CAInstance(service.Service):
enabled = self.restore_state("enabled")
if not enabled is None and not enabled:
- self.chkconfig_off()
+ self.service_off()
try:
ipautil.run(["/usr/bin/pkiremove", "-pki_instance_root=/var/lib",
diff --git a/ipaserver/install/certs.py b/ipaserver/install/certs.py
index f14efe33f..99045dcbb 100644
--- a/ipaserver/install/certs.py
+++ b/ipaserver/install/certs.py
@@ -483,7 +483,7 @@ class CertDB(object):
"""
Tell certmonger to track the given certificate nickname.
"""
- service.chkconfig_on("certmonger")
+ service.service_on("certmonger")
service.start("messagebus")
service.start("certmonger")
try:
diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py
index 50060832e..deebd221f 100644
--- a/ipaserver/install/dsinstance.py
+++ b/ipaserver/install/dsinstance.py
@@ -324,8 +324,8 @@ class DsInstance(service.Service):
self.backup_state("enabled", self.is_enabled())
# At the end of the installation ipa-server-install will enable the
# 'ipa' service wich takes care of starting/stopping dirsrv
- # self.chkconfig_on()
- self.chkconfig_off()
+ # self.service_on()
+ self.service_off()
def __setup_sub_dict(self):
server_root = find_server_root()
@@ -657,7 +657,7 @@ class DsInstance(service.Service):
pass
if not enabled is None and not enabled:
- self.chkconfig_off()
+ self.service_off()
serverid = self.restore_state("serverid")
if not serverid is None:
diff --git a/ipaserver/install/httpinstance.py b/ipaserver/install/httpinstance.py
index fe5f7aa95..6a863cb17 100644
--- a/ipaserver/install/httpinstance.py
+++ b/ipaserver/install/httpinstance.py
@@ -259,7 +259,7 @@ class HTTPInstance(service.Service):
db = certs.CertDB(api.env.realm)
db.untrack_server_cert("Server-Cert")
if not enabled is None and not enabled:
- self.chkconfig_off()
+ self.service_off()
for f in ["/etc/httpd/conf.d/ipa.conf", SSL_CONF, NSS_CONF]:
try:
diff --git a/ipaserver/install/krbinstance.py b/ipaserver/install/krbinstance.py
index 5326e2f23..1f66723c7 100644
--- a/ipaserver/install/krbinstance.py
+++ b/ipaserver/install/krbinstance.py
@@ -572,7 +572,7 @@ class KrbInstance(service.Service):
pass
if not enabled is None and not enabled:
- self.chkconfig_off()
+ self.service_off()
if not running is None and running:
self.start()
diff --git a/ipaserver/install/ntpinstance.py b/ipaserver/install/ntpinstance.py
index d85e430b7..7fc16d495 100644
--- a/ipaserver/install/ntpinstance.py
+++ b/ipaserver/install/ntpinstance.py
@@ -143,7 +143,7 @@ class NTPInstance(service.Service):
def __enable(self):
self.backup_state("enabled", self.is_enabled())
- self.chkconfig_on()
+ self.service_on()
def create_instance(self):
@@ -174,7 +174,7 @@ class NTPInstance(service.Service):
pass
if not enabled is None and not enabled:
- self.chkconfig_off()
+ self.service_off()
if not running is None and running:
self.start()
diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py
index 62db9baf5..0d8398bdf 100644
--- a/ipaserver/install/service.py
+++ b/ipaserver/install/service.py
@@ -22,6 +22,7 @@ import os, socket
import tempfile
from ipapython import sysrestore
from ipapython import ipautil
+from ipapython import services as ipaservices
from ipalib import errors
import ldap
from ipaserver import ipaldap
@@ -41,34 +42,34 @@ SERVICE_LIST = {
}
def stop(service_name, instance_name="", capture_output=True):
- ipautil.service_stop(service_name, instance_name, capture_output)
+ ipaservices.service_stop(service_name, instance_name, capture_output)
def start(service_name, instance_name="", capture_output=True):
- ipautil.service_start(service_name, instance_name, capture_output)
+ ipaservices.service_start(service_name, instance_name, capture_output)
def restart(service_name, instance_name="", capture_output=True):
- ipautil.service_restart(service_name, instance_name, capture_output)
+ ipaservices.service_restart(service_name, instance_name, capture_output)
def is_running(service_name, instance_name=""):
- return ipautil.service_is_running(service_name, instance_name)
+ return ipaservices.service_is_running(service_name, instance_name)
def is_installed(service_name):
- return ipautil.service_is_installed(service_name)
+ return ipaservices.service_is_installed(service_name)
-def chkconfig_on(service_name):
- ipautil.chkconfig_on(service_name)
+def service_on(service_name):
+ ipaservices.service_on(service_name)
-def chkconfig_off(service_name):
- ipautil.chkconfig_on(service_name)
+def service_off(service_name):
+ ipaservices.service_on(service_name)
-def chkconfig_add(service_name):
- ipautil.chkconfig_on(service_name)
+def service_add(service_name):
+ ipaservices.service_on(service_name)
-def chkconfig_del(service_name):
- ipautil.chkconfig_on(service_name)
+def service_del(service_name):
+ ipaservices.service_on(service_name)
def is_enabled(service_name):
- return ipautil.service_is_enabled(service_name)
+ return ipaservices.service_is_enabled(service_name)
def print_msg(message, output_fd=sys.stdout):
logging.debug(message)
@@ -224,17 +225,17 @@ class Service(object):
def is_running(self):
return is_running(self.service_name)
- def chkconfig_add(self):
- chkconfig_add(self.service_name)
+ def service_add(self):
+ service_add(self.service_name)
- def chkconfig_del(self):
- chkconfig_del(self.service_name)
+ def service_del(self):
+ service_del(self.service_name)
- def chkconfig_on(self):
- chkconfig_on(self.service_name)
+ def service_on(self):
+ service_on(self.service_name)
- def chkconfig_off(self):
- chkconfig_off(self.service_name)
+ def service_off(self):
+ service_off(self.service_name)
def is_enabled(self):
return is_enabled(self.service_name)
@@ -300,7 +301,7 @@ class Service(object):
return conn
def ldap_enable(self, name, fqdn, dm_password, ldap_suffix):
- self.chkconfig_off()
+ self.service_off()
conn = self.__get_conn(fqdn, dm_password)
entry_name = "cn=%s,cn=%s,%s,%s" % (name, fqdn,
@@ -336,10 +337,10 @@ class SimpleServiceInstance(Service):
self.restart()
def __enable(self):
- self.chkconfig_add()
+ self.service_add()
self.backup_state("enabled", self.is_enabled())
if self.gensvc_name == None:
- self.chkconfig_on()
+ self.service_on()
else:
self.ldap_enable(self.gensvc_name, self.fqdn,
self.dm_password, self.suffix)
@@ -354,5 +355,5 @@ class SimpleServiceInstance(Service):
if not running is None and not running:
self.stop()
if not enabled is None and not enabled:
- self.chkconfig_off()
- self.chkconfig_del()
+ self.service_off()
+ self.service_del()