From b5e06b90c9113836eef5b04f0993097314d2be84 Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Mon, 9 Feb 2015 16:18:28 +0100 Subject: 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 --- install/tools/ipa-server-install | 10 ++++++++-- ipaserver/install/dnskeysyncinstance.py | 10 ++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install index 8b2b8a3c2..56a43770d 100755 --- a/install/tools/ipa-server-install +++ b/install/tools/ipa-server-install @@ -597,8 +597,14 @@ def uninstall(): if ods_exporter.is_configured(): ods_exporter.uninstall() - bindinstance.BindInstance(fstore).uninstall() - dnskeysyncinstance.DNSKeySyncInstance(fstore).uninstall() + bind = bindinstance.BindInstance(fstore) + if bind.is_configured(): + bind.uninstall() + + dnskeysync = dnskeysyncinstance.DNSKeySyncInstance(fstore) + if dnskeysync.is_configured(): + dnskeysync.uninstall() + httpinstance.HTTPInstance(fstore).uninstall() krbinstance.KrbInstance(fstore).uninstall() dsinstance.DsInstance(fstore=fstore).uninstall() diff --git a/ipaserver/install/dnskeysyncinstance.py b/ipaserver/install/dnskeysyncinstance.py index 1396d01a7..090c87505 100644 --- a/ipaserver/install/dnskeysyncinstance.py +++ b/ipaserver/install/dnskeysyncinstance.py @@ -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() -- cgit