Ticket #860

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York
>From 9a89ffcf05a59e92cec86f9a7b2b93f353ec2cb6 Mon Sep 17 00:00:00 2001
From: Simo Sorce <sso...@redhat.com>
Date: Thu, 27 Jan 2011 17:10:34 -0500
Subject: [PATCH] Make sure all DS instances are managed by ipactl

Fixes: https://fedorahosted.org/freeipa/ticket/860
---
 install/tools/ipactl |   38 ++++++++++++++++++--------------------
 1 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/install/tools/ipactl b/install/tools/ipactl
index fc652c9754cf63e8d9d46a3b20866b94df3ab698..20b4a69b704c9004fa9aee40119bdd442a449166 100755
--- a/install/tools/ipactl
+++ b/install/tools/ipactl
@@ -85,11 +85,11 @@ def get_config():
 
     return svc_list
 
-def ipa_start(serverid):
+def ipa_start():
 
     try:
         print "Starting Directory Service"
-        service.start('dirsrv', instance_name=serverid, capture_output=False)
+        service.start('dirsrv', capture_output=False)
     except:
         emit_err("Failed to start Directory Service")
         return
@@ -100,7 +100,7 @@ def ipa_start(serverid):
     except:
         emit_err("Failed to read data from Directory Service")
         emit_err("Shutting down")
-        service.stop('dirsrv', instance_name=serverid, capture_output=False)
+        service.stop('dirsrv', capture_output=False)
 
     if len(svc_list) == 0:
         return
@@ -120,12 +120,12 @@ def ipa_start(serverid):
                 except:
                     pass
             try:
-                service.stop('dirsrv', instance_name=serverid, capture_output=False)
+                service.stop('dirsrv', capture_output=False)
             except:
                 pass
             return
 
-def ipa_stop(serverid):
+def ipa_stop():
 
     svc_list = []
     try:
@@ -135,12 +135,12 @@ def ipa_stop(serverid):
         # and see if we can get anything. If not throw our hands up and just
         # exit
         try:
-            service.start('dirsrv', instance_name=serverid, capture_output=False)
+            service.start('dirsrv', capture_output=False)
             svc_list = get_config()
         except:
             emit_err("Failed to read data from Directory Service")
             emit_err("Shutting down")
-            service.stop('dirsrv', instance_name=serverid, capture_output=False)
+            service.stop('dirsrv', capture_output=False)
 
     if len(svc_list) == 0:
         return
@@ -155,16 +155,16 @@ def ipa_stop(serverid):
 
     try:
         print "Stopping Directory Service"
-        service.stop('dirsrv', instance_name=serverid, capture_output=False)
+        service.stop('dirsrv', capture_output=False)
     except:
         emit_err("Failed to stop Directory Service")
         return
 
 
-def ipa_restart(serverid):
+def ipa_restart():
     try:
         print "Restarting Directory Service"
-        service.restart('dirsrv', instance_name=serverid, capture_output=False)
+        service.restart('dirsrv', capture_output=False)
     except:
         emit_err("Failed to restart Directory Service")
         return
@@ -175,7 +175,7 @@ def ipa_restart(serverid):
     except:
         emit_err("Failed to read data from Directory Service")
         emit_err("Shutting down")
-        service.stop('dirsrv', instance_name=serverid, capture_output=False)
+        service.stop('dirsrv', capture_output=False)
 
     if len(svc_list) == 0:
         return
@@ -195,14 +195,14 @@ def ipa_restart(serverid):
                 except:
                     pass
             try:
-                service.stop('dirsrv', instance_name=serverid, capture_output=False)
+                service.stop('dirsrv', capture_output=False)
             except:
                 pass
             return
 
-def ipa_status(serverid):
+def ipa_status():
     try:
-        if service.is_running('dirsrv', instance_name=serverid):
+        if service.is_running('dirsrv'):
             print "Directory Service: RUNNING"
         else:
             print "Directory Service: STOPPED"
@@ -241,16 +241,14 @@ def main():
     api.bootstrap(context='cli', debug=options.debug)
     api.finalize()
 
-    serverid = dsinstance.realm_to_serverid(api.env.realm)
-
     if args[0].lower() == "start":
-        ipa_start(serverid)
+        ipa_start()
     elif args[0].lower() == "stop":
-        ipa_stop(serverid)
+        ipa_stop()
     elif args[0].lower() == "restart":
-        ipa_restart(serverid)
+        ipa_restart()
     elif args[0].lower() == "status":
-        ipa_status(serverid)
+        ipa_status()
 
 try:
     if __name__ == "__main__":
-- 
1.7.3.5

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

Reply via email to