mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-27 00:26:33 -06:00
only stop/disable simple service if it is installed
The SimpleServiceInstance uninstaller assument that the service to uninstall was always present on the system. This may not be valid in some cases (e.g. containerized deployments) and thus we need to change the service state only when we know that the unit file exists. https://pagure.io/freeipa/issue/6977 Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
parent
58fd229a1d
commit
8b6f8ed7d4
@ -674,18 +674,21 @@ class SimpleServiceInstance(Service):
|
||||
else:
|
||||
self.ldap_enable(self.gensvc_name, self.fqdn, None, self.suffix)
|
||||
|
||||
def is_installed(self):
|
||||
return self.service.is_installed()
|
||||
|
||||
def uninstall(self):
|
||||
if self.is_configured():
|
||||
self.print_msg("Unconfiguring %s" % self.service_name)
|
||||
|
||||
self.stop()
|
||||
self.disable()
|
||||
|
||||
running = self.restore_state("running")
|
||||
enabled = self.restore_state("enabled")
|
||||
|
||||
# restore the original state of service
|
||||
if running:
|
||||
self.start()
|
||||
if enabled:
|
||||
self.enable()
|
||||
if self.is_installed():
|
||||
self.stop()
|
||||
self.disable()
|
||||
|
||||
if running:
|
||||
self.start()
|
||||
if enabled:
|
||||
self.enable()
|
||||
|
Loading…
Reference in New Issue
Block a user