Uninstall configured services only

Fixes:
dnskeysyncisntance - requires a stored state to be uninstalled
bindinstance - uninstal service only if bind was configured by IPA

Ticket:https://fedorahosted.org/freeipa/ticket/4869

Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
Martin Basti
2015-02-09 16:18:28 +01:00
committed by Martin Kosek
parent f499e506c8
commit b5e06b90c9
2 changed files with 14 additions and 6 deletions

View File

@@ -179,6 +179,9 @@ class DNSKeySyncInstance(service.Service):
):
raise RuntimeError("DNS container does not exist")
# ready to be installed, storing a state is required to run uninstall
self.backup_state("configured", True)
def __setup_dnssec_containers(self):
"""
Setup LDAP containers for DNSSEC
@@ -472,14 +475,13 @@ class DNSKeySyncInstance(service.Service):
def uninstall(self):
if not self.is_configured():
return
self.print_msg("Unconfiguring %s" % self.service_name)
if self.is_configured():
self.print_msg("Unconfiguring %s" % self.service_name)
# Just eat states
self.restore_state("running")
self.restore_state("enabled")
self.restore_state("configured")
# stop and disable service (IPA service, we do not need it anymore)
self.stop()