summaryrefslogtreecommitdiffstats
path: root/ipaserver/install/dsinstance.py
diff options
context:
space:
mode:
authorAlexander Bokovoy <abokovoy@redhat.com>2011-09-13 00:10:45 +0300
committerMartin Kosek <mkosek@redhat.com>2011-09-13 11:35:25 +0200
commit7059bd195e3901c52920205b1fd9b91a8b2a52ca (patch)
tree7c751cacb02a964587d18960578a2c840e78a0e1 /ipaserver/install/dsinstance.py
parentb73b0178971a0547ba72a9fdfaa85ad4cfa1cacf (diff)
downloadfreeipa-7059bd195e3901c52920205b1fd9b91a8b2a52ca.zip
freeipa-7059bd195e3901c52920205b1fd9b91a8b2a52ca.tar.gz
freeipa-7059bd195e3901c52920205b1fd9b91a8b2a52ca.tar.xz
Convert server install code to platform-independent access to system services
https://fedorahosted.org/freeipa/ticket/1605
Diffstat (limited to 'ipaserver/install/dsinstance.py')
-rw-r--r--ipaserver/install/dsinstance.py23
1 files changed, 6 insertions, 17 deletions
diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py
index 8ccb22c..5abd5f3 100644
--- a/ipaserver/install/dsinstance.py
+++ b/ipaserver/install/dsinstance.py
@@ -30,6 +30,7 @@ import tempfile
from ipapython import ipautil
from ipapython import sysrestore
+from ipapython import services as ipaservices
import service
import installutils
@@ -107,18 +108,7 @@ def check_ports():
return (ds_unsecure, ds_secure)
def is_ds_running():
- """The DS init script always returns 0 when requesting status so it cannot
- be used to determine if the server is running. We have to look at the
- output.
- """
- ret = True
- try:
- (sout, serr, rcode) = ipautil.run(["/sbin/service", "dirsrv", "status"])
- if sout.find("is stopped") >= 0:
- ret = False
- except ipautil.CalledProcessError:
- ret = False
- return ret
+ return ipaservices.knownservices.dirsrv.is_running()
def has_managed_entries(host_name, dm_password):
"""Check to see if the Managed Entries plugin is available"""
@@ -310,8 +300,7 @@ 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.disable()
def __setup_sub_dict(self):
server_root = find_server_root()
@@ -329,10 +318,10 @@ class DsInstance(service.Service):
def __create_ds_user(self):
user_exists = True
- try:
+ try:
pwd.getpwnam(DS_USER)
logging.debug("ds user %s exists" % DS_USER)
- except KeyError:
+ except KeyError:
user_exists = False
logging.debug("adding ds user %s" % DS_USER)
args = ["/usr/sbin/useradd", "-g", DS_GROUP,
@@ -644,7 +633,7 @@ class DsInstance(service.Service):
pass
if not enabled is None and not enabled:
- self.chkconfig_off()
+ self.disable()
serverid = self.restore_state("serverid")
if not serverid is None: