summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2011-05-04 10:21:27 -0400
committerMartin Kosek <mkosek@redhat.com>2011-05-06 15:46:41 +0200
commitd1fd695467b9e831f0a774605b0d44cd009230fe (patch)
treee6647e63437ea441aefb6d7ee75688b45db976ae
parenta4aba826a0e1327ba8df05da19d9ad0055d8269d (diff)
downloadfreeipa-d1fd695467b9e831f0a774605b0d44cd009230fe.tar.gz
freeipa-d1fd695467b9e831f0a774605b0d44cd009230fe.tar.xz
freeipa-d1fd695467b9e831f0a774605b0d44cd009230fe.zip
install-scripts: avoid using --list with chkconfig
This option does not behave properly in F15 as chkconfig does not list services moved to use systemd service files. Plus there are more direct ways than parsing its output, which are more reliable. Also just testing for the availability of the service calling 'chkconfig name' is enough. https://fedorahosted.org/freeipa/ticket/1206
-rwxr-xr-xipa-client/ipa-install/ipa-client-install6
-rw-r--r--ipaserver/install/service.py20
2 files changed, 2 insertions, 24 deletions
diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
index 5533b9ab2..6265a7c2e 100755
--- a/ipa-client/ipa-install/ipa-client-install
+++ b/ipa-client/ipa-install/ipa-client-install
@@ -169,12 +169,6 @@ def chkconfig(name, status):
chkconfig returns 1 if the service is unknown, 0 otherwise
"""
- (sout, serr, returncode) = run(['/sbin/chkconfig', name, '--list'], raiseonerr=False)
-
- # If the service isn't installed return with no error
- if returncode == 1:
- return
-
args = ['/sbin/chkconfig', name, status]
(sout, serr, returncode) = run(args, raiseonerr=False)
diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py
index 1ebd96d7b..0d3192700 100644
--- a/ipaserver/install/service.py
+++ b/ipaserver/install/service.py
@@ -73,24 +73,8 @@ def chkconfig_del(service_name):
ipautil.run(["/sbin/chkconfig", "--del", service_name])
def is_enabled(service_name):
- (stdout, stderr, returncode) = ipautil.run(["/sbin/chkconfig", "--list", service_name])
-
- runlevels = {}
- for runlevel in range(0, 7):
- runlevels[runlevel] = False
-
- for line in stdout.split("\n"):
- parts = line.split()
- if parts[0] == service_name:
- for s in parts[1:]:
- (runlevel, status) = s.split(":")[0:2]
- try:
- runlevels[int(runlevel)] = status == "on"
- except ValueError:
- pass
- break
-
- return (runlevels[3] and runlevels[4] and runlevels[5])
+ (stdout, stderr, returncode) = ipautil.run(["/sbin/chkconfig", service_name], raiseonerr=False)
+ return (returncode == 0)
def print_msg(message, output_fd=sys.stdout):
logging.debug(message)