mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Only update the list of running services in the installer or ipactl.
The file is only present in the case of a server installation. It should only be touched by the server installer and ipactl. https://fedorahosted.org/freeipa/ticket/3277
This commit is contained in:
parent
146da1b326
commit
62e7053a12
@ -420,7 +420,10 @@ def ipa_status(options):
|
|||||||
try:
|
try:
|
||||||
svc_list = get_config_from_file()
|
svc_list = get_config_from_file()
|
||||||
except IpactlError, e:
|
except IpactlError, e:
|
||||||
raise e
|
if os.path.exists(ipaservices.get_svc_list_file()):
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
svc_list = []
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
raise IpactlError("Failed to get list of services to probe status: " + str(e))
|
raise IpactlError("Failed to get list of services to probe status: " + str(e))
|
||||||
|
|
||||||
@ -430,6 +433,9 @@ def ipa_status(options):
|
|||||||
print "Directory Service: RUNNING"
|
print "Directory Service: RUNNING"
|
||||||
else:
|
else:
|
||||||
print "Directory Service: STOPPED"
|
print "Directory Service: STOPPED"
|
||||||
|
if len(svc_list) == 0:
|
||||||
|
print ("Directory Service must be running in order to " +
|
||||||
|
"obtain status of other services")
|
||||||
except:
|
except:
|
||||||
raise IpactlError("Failed to get Directory Service status")
|
raise IpactlError("Failed to get Directory Service status")
|
||||||
|
|
||||||
@ -473,7 +479,7 @@ def main():
|
|||||||
else:
|
else:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
api.bootstrap(context='cli', debug=options.debug)
|
api.bootstrap(context='ipactl', debug=options.debug)
|
||||||
api.finalize()
|
api.finalize()
|
||||||
|
|
||||||
if '.' not in api.env.host:
|
if '.' not in api.env.host:
|
||||||
|
@ -136,12 +136,15 @@ class PlatformService(object):
|
|||||||
def __init__(self, service_name):
|
def __init__(self, service_name):
|
||||||
self.service_name = service_name
|
self.service_name = service_name
|
||||||
|
|
||||||
def start(self, instance_name="", capture_output=True, wait=True):
|
def start(self, instance_name="", capture_output=True, wait=True,
|
||||||
|
update_service_list=True):
|
||||||
"""
|
"""
|
||||||
When a service is started record the fact in a special file.
|
When a service is started record the fact in a special file.
|
||||||
This allows ipactl stop to always stop all services that have
|
This allows ipactl stop to always stop all services that have
|
||||||
been started via ipa tools
|
been started via ipa tools
|
||||||
"""
|
"""
|
||||||
|
if not update_service_list:
|
||||||
|
return
|
||||||
svc_list = []
|
svc_list = []
|
||||||
try:
|
try:
|
||||||
f = open(SVC_LIST_FILE, 'r')
|
f = open(SVC_LIST_FILE, 'r')
|
||||||
@ -159,10 +162,12 @@ class PlatformService(object):
|
|||||||
f.close()
|
f.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
def stop(self, instance_name="", capture_output=True):
|
def stop(self, instance_name="", capture_output=True, update_service_list=True):
|
||||||
"""
|
"""
|
||||||
When a service is stopped remove it from the service list file.
|
When a service is stopped remove it from the service list file.
|
||||||
"""
|
"""
|
||||||
|
if not update_service_list:
|
||||||
|
return
|
||||||
svc_list = []
|
svc_list = []
|
||||||
try:
|
try:
|
||||||
f = open(SVC_LIST_FILE, 'r')
|
f = open(SVC_LIST_FILE, 'r')
|
||||||
|
@ -91,13 +91,21 @@ class SystemdService(base.PlatformService):
|
|||||||
|
|
||||||
def stop(self, instance_name="", capture_output=True):
|
def stop(self, instance_name="", capture_output=True):
|
||||||
ipautil.run(["/bin/systemctl", "stop", self.service_instance(instance_name)], capture_output=capture_output)
|
ipautil.run(["/bin/systemctl", "stop", self.service_instance(instance_name)], capture_output=capture_output)
|
||||||
super(SystemdService, self).stop(instance_name)
|
if 'context' in api.env and api.env.context in ['ipactl', 'installer']:
|
||||||
|
update_service_list = True
|
||||||
|
else:
|
||||||
|
update_service_list = False
|
||||||
|
super(SystemdService, self).stop(instance_name,update_service_list=update_service_list)
|
||||||
|
|
||||||
def start(self, instance_name="", capture_output=True, wait=True):
|
def start(self, instance_name="", capture_output=True, wait=True):
|
||||||
ipautil.run(["/bin/systemctl", "start", self.service_instance(instance_name)], capture_output=capture_output)
|
ipautil.run(["/bin/systemctl", "start", self.service_instance(instance_name)], capture_output=capture_output)
|
||||||
|
if 'context' in api.env and api.env.context in ['ipactl', 'installer']:
|
||||||
|
update_service_list = True
|
||||||
|
else:
|
||||||
|
update_service_list = False
|
||||||
if wait and self.is_running(instance_name):
|
if wait and self.is_running(instance_name):
|
||||||
self.__wait_for_open_ports(self.service_instance(instance_name))
|
self.__wait_for_open_ports(self.service_instance(instance_name))
|
||||||
super(SystemdService, self).start(instance_name)
|
super(SystemdService, self).start(instance_name, update_service_list=update_service_list)
|
||||||
|
|
||||||
def restart(self, instance_name="", capture_output=True, wait=True):
|
def restart(self, instance_name="", capture_output=True, wait=True):
|
||||||
# Restart command is broken before systemd-36-3.fc16
|
# Restart command is broken before systemd-36-3.fc16
|
||||||
|
Loading…
Reference in New Issue
Block a user