[freeipa] Fix bug #702633

Simo Sorce simo at fedoraproject.org
Fri May 6 20:23:30 UTC 2011


commit e3b0a5690fe103fbfa89884a09f9c52948490258
Author: Simo Sorce <ssorce at redhat.com>
Date:   Fri May 6 10:33:31 2011 -0400

    Fix bug #702633

 ...l-scripts-avoid-using-list-with-chkconfig.patch |   69 ++++++++++++++++++++
 freeipa.spec                                       |    9 ++-
 2 files changed, 77 insertions(+), 1 deletions(-)
---
diff --git a/0001-install-scripts-avoid-using-list-with-chkconfig.patch b/0001-install-scripts-avoid-using-list-with-chkconfig.patch
new file mode 100644
index 0000000..e1ba2e3
--- /dev/null
+++ b/0001-install-scripts-avoid-using-list-with-chkconfig.patch
@@ -0,0 +1,69 @@
+From 76e279ce07c660a9a524b9cbdb21f4e7fd33862e Mon Sep 17 00:00:00 2001
+From: Simo Sorce <ssorce at redhat.com>
+Date: Wed, 4 May 2011 10:21:27 -0400
+Subject: [PATCH] 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.
+---
+ ipa-client/ipa-install/ipa-client-install |    6 ------
+ ipaserver/install/service.py              |   20 ++------------------
+ 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 5533b9ab2ea35c0d216f9cd8339570da19c66623..6265a7c2e943338103d36962a5a5d0b810c7e3d7 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 1ebd96d7b48a8d8d1df41950da517e18383f2d9c..0d31927009df084049c36a1e3c9d0b7d3c6511da 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)
+-- 
+1.7.4.4
+
diff --git a/freeipa.spec b/freeipa.spec
index ba94ce6..0e52e1f 100644
--- a/freeipa.spec
+++ b/freeipa.spec
@@ -14,7 +14,7 @@ distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
 
 Name:           freeipa
 Version:        2.0.1
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        The Identity, Policy and Audit system
 
 Group:          System Environment/Base
@@ -23,6 +23,8 @@ URL:            http://www.freeipa.org/
 Source0:        http://www.freeipa.org/downloads/src/freeipa-%{version}.tar.gz
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
+Patch0: 0001-install-scripts-avoid-using-list-with-chkconfig.patch
+
 %if ! %{ONLY_CLIENT}
 BuildRequires:  389-ds-base-devel >= 1.2.8
 BuildRequires:  svrcore-devel
@@ -195,6 +197,8 @@ package.
 %prep
 %setup -n freeipa-%{version} -q
 
+%patch0 -p1
+
 %build
 export CFLAGS="$CFLAGS %{optflags}"
 export CPPFLAGS="$CPPFLAGS %{optflags}"
@@ -485,6 +489,9 @@ fi
 %ghost %attr(0644,root,apache) %config(noreplace) %{_sysconfdir}/ipa/default.conf
 
 %changelog
+* Fri May  6 2011 Simo Sorce <ssorce at redhat.com> - 2.0.1-2
+- Fix bug #702633
+
 * Mon May  2 2011 Rob Crittenden <rcritten at redhat.com> - 2.0.1-1
 - Update minimum selinux-policy to 3.9.16-18
 - Update minimum pki-ca and pki-selinux to 9.0.7


More information about the scm-commits mailing list