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
|
return svc_list
|
||||||
|
|
||||||
def ipa_start(serverid):
|
def ipa_start():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print "Starting Directory Service"
|
print "Starting Directory Service"
|
||||||
service.start('dirsrv', instance_name=serverid, capture_output=False)
|
service.start('dirsrv', capture_output=False)
|
||||||
except:
|
except:
|
||||||
emit_err("Failed to start Directory Service")
|
emit_err("Failed to start Directory Service")
|
||||||
return
|
return
|
||||||
@ -100,7 +100,7 @@ def ipa_start(serverid):
|
|||||||
except:
|
except:
|
||||||
emit_err("Failed to read data from Directory Service")
|
emit_err("Failed to read data from Directory Service")
|
||||||
emit_err("Shutting down")
|
emit_err("Shutting down")
|
||||||
service.stop('dirsrv', instance_name=serverid, capture_output=False)
|
service.stop('dirsrv', capture_output=False)
|
||||||
|
|
||||||
if len(svc_list) == 0:
|
if len(svc_list) == 0:
|
||||||
return
|
return
|
||||||
@ -120,12 +120,12 @@ def ipa_start(serverid):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
service.stop('dirsrv', instance_name=serverid, capture_output=False)
|
service.stop('dirsrv', capture_output=False)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
return
|
return
|
||||||
|
|
||||||
def ipa_stop(serverid):
|
def ipa_stop():
|
||||||
|
|
||||||
svc_list = []
|
svc_list = []
|
||||||
try:
|
try:
|
||||||
@ -135,12 +135,12 @@ def ipa_stop(serverid):
|
|||||||
# and see if we can get anything. If not throw our hands up and just
|
# and see if we can get anything. If not throw our hands up and just
|
||||||
# exit
|
# exit
|
||||||
try:
|
try:
|
||||||
service.start('dirsrv', instance_name=serverid, capture_output=False)
|
service.start('dirsrv', capture_output=False)
|
||||||
svc_list = get_config()
|
svc_list = get_config()
|
||||||
except:
|
except:
|
||||||
emit_err("Failed to read data from Directory Service")
|
emit_err("Failed to read data from Directory Service")
|
||||||
emit_err("Shutting down")
|
emit_err("Shutting down")
|
||||||
service.stop('dirsrv', instance_name=serverid, capture_output=False)
|
service.stop('dirsrv', capture_output=False)
|
||||||
|
|
||||||
if len(svc_list) == 0:
|
if len(svc_list) == 0:
|
||||||
return
|
return
|
||||||
@ -155,16 +155,16 @@ def ipa_stop(serverid):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
print "Stopping Directory Service"
|
print "Stopping Directory Service"
|
||||||
service.stop('dirsrv', instance_name=serverid, capture_output=False)
|
service.stop('dirsrv', capture_output=False)
|
||||||
except:
|
except:
|
||||||
emit_err("Failed to stop Directory Service")
|
emit_err("Failed to stop Directory Service")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def ipa_restart(serverid):
|
def ipa_restart():
|
||||||
try:
|
try:
|
||||||
print "Restarting Directory Service"
|
print "Restarting Directory Service"
|
||||||
service.restart('dirsrv', instance_name=serverid, capture_output=False)
|
service.restart('dirsrv', capture_output=False)
|
||||||
except:
|
except:
|
||||||
emit_err("Failed to restart Directory Service")
|
emit_err("Failed to restart Directory Service")
|
||||||
return
|
return
|
||||||
@ -175,7 +175,7 @@ def ipa_restart(serverid):
|
|||||||
except:
|
except:
|
||||||
emit_err("Failed to read data from Directory Service")
|
emit_err("Failed to read data from Directory Service")
|
||||||
emit_err("Shutting down")
|
emit_err("Shutting down")
|
||||||
service.stop('dirsrv', instance_name=serverid, capture_output=False)
|
service.stop('dirsrv', capture_output=False)
|
||||||
|
|
||||||
if len(svc_list) == 0:
|
if len(svc_list) == 0:
|
||||||
return
|
return
|
||||||
@ -195,14 +195,14 @@ def ipa_restart(serverid):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
service.stop('dirsrv', instance_name=serverid, capture_output=False)
|
service.stop('dirsrv', capture_output=False)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
return
|
return
|
||||||
|
|
||||||
def ipa_status(serverid):
|
def ipa_status():
|
||||||
try:
|
try:
|
||||||
if service.is_running('dirsrv', instance_name=serverid):
|
if service.is_running('dirsrv'):
|
||||||
print "Directory Service: RUNNING"
|
print "Directory Service: RUNNING"
|
||||||
else:
|
else:
|
||||||
print "Directory Service: STOPPED"
|
print "Directory Service: STOPPED"
|
||||||
@ -241,16 +241,14 @@ def main():
|
|||||||
api.bootstrap(context='cli', debug=options.debug)
|
api.bootstrap(context='cli', debug=options.debug)
|
||||||
api.finalize()
|
api.finalize()
|
||||||
|
|
||||||
serverid = dsinstance.realm_to_serverid(api.env.realm)
|
|
||||||
|
|
||||||
if args[0].lower() == "start":
|
if args[0].lower() == "start":
|
||||||
ipa_start(serverid)
|
ipa_start()
|
||||||
elif args[0].lower() == "stop":
|
elif args[0].lower() == "stop":
|
||||||
ipa_stop(serverid)
|
ipa_stop()
|
||||||
elif args[0].lower() == "restart":
|
elif args[0].lower() == "restart":
|
||||||
ipa_restart(serverid)
|
ipa_restart()
|
||||||
elif args[0].lower() == "status":
|
elif args[0].lower() == "status":
|
||||||
ipa_status(serverid)
|
ipa_status()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user