mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Make sure all DS instances are managed by ipactl
Fixes: https://fedorahosted.org/freeipa/ticket/860
This commit is contained in:
parent
878aa9ee1f
commit
3cb33d74ae
@ -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__":
|
||||
|
Loading…
Reference in New Issue
Block a user