IPA sorts service order alphabetically, this patch modify ipactl to use integers.

How to reproduce:
set attribute ipaConfigString: startOrder 150
DN: cn=HTTP,cn=ipa.example.com,cn=masters,cn=ipa,cn=etc,dc=example,dc=com

then run
#ipactl restart

httpd service should start as last service, but it starts almost first.

Patch attached.

--
Martin Basti

From 277e71a1ce05636fd3961276f626335fe9bfbbbe Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Wed, 8 Oct 2014 16:40:53 +0200
Subject: [PATCH] Fix ipactl service ordering

Ipactl sorted service start order as string, which causes service with start order
100 starts before service with start order 30.

Patch fixes ipactl to use integers for ordering.
---
 install/tools/ipactl | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/install/tools/ipactl b/install/tools/ipactl
index 3f0e79867032b61f63e0626ce33df75df14cecab..7a1e41b01a80eeea85c417399dcf4666f70d4b26 100755
--- a/install/tools/ipactl
+++ b/install/tools/ipactl
@@ -159,7 +159,11 @@ def get_config(dirsrv):
         name = entry.single_value['cn']
         for p in entry['ipaConfigString']:
             if p.startswith('startOrder '):
-                order = p.split()[1]
+                try:
+                    order = int(p.split()[1])
+                except ValueError:
+                    raise IpactlError("Expected order as integer in: %s:%s" % (
+                        name, p))
         svc_list.append([order, name])
 
     ordered_list = []
-- 
1.8.3.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to