diff options
author | Alexander Bokovoy <abokovoy@redhat.com> | 2011-09-13 10:47:13 +0300 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2011-09-13 11:14:18 +0200 |
commit | a02e0514f60f8ce5716876717b77e8712cc38396 (patch) | |
tree | 4bd64a56e9a0093e859767a18b1eed6d73afb216 /ipaserver/install/dsinstance.py | |
parent | b996a41177df9e41426155d3445dc20b0657c9d5 (diff) | |
download | freeipa-a02e0514f60f8ce5716876717b77e8712cc38396.tar.gz freeipa-a02e0514f60f8ce5716876717b77e8712cc38396.tar.xz freeipa-a02e0514f60f8ce5716876717b77e8712cc38396.zip |
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.py | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py index 2b996b5c8..3ef9dda95 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, @@ -646,7 +635,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: |