Thanks, Petr. Updated patch attached.

Gabe

On Mon, Oct 12, 2015 at 12:47 AM, Petr Spacek <pspa...@redhat.com> wrote:

> Hello Gabe,
>
> thank you for your patch!
>
> Please note that there might be a case where detection is_ipa_configured()
> is
> broken but the user still needs to run the uninstall process to clean it
> up.
>
> Could you amend the patch to respect --force option? In that case the
> detection should be skipped.
>
> Thank you for your time!
>
> Petr^2 Spacek
>
> On 9.10.2015 19:17, Gabe Alford wrote:
> > diff --git a/ipaserver/install/server/install.py
> b/ipaserver/install/server/install.py
> > index
> 13a59a0e6149dc22ded4a895db02516e9360e02b..ca93e7a6fd7276d9c0d82eb6f94575730759d858
> 100644
> > --- a/ipaserver/install/server/install.py
> > +++ b/ipaserver/install/server/install.py
> > @@ -954,6 +954,12 @@ def uninstall_check(installer):
> >
> >      installer._installation_cleanup = False
> >
> > +    if not is_ipa_configured():
> > +        print("IPA server is not configured on this system.\n" +
> > +              "If you want to install the IPA server, please install " +
> > +              "it using 'ipa-server-install'.")
> > +        sys.exit(1)
> > +
> >      fstore = sysrestore.FileStore(SYSRESTORE_DIR_PATH)
> >      sstore = sysrestore.StateFile(SYSRESTORE_DIR_PATH)
>
> --
> Manage your subscription for the Freeipa-devel mailing list:
> https://www.redhat.com/mailman/listinfo/freeipa-devel
> Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
>
From 8391b79754a453dca672e8a341a9d949064c4c2b Mon Sep 17 00:00:00 2001
From: Gabe <redhatri...@gmail.com>
Date: Mon, 12 Oct 2015 09:09:31 -0600
Subject: [PATCH] Warn if no installation found when running ipa-server-install
  --uninstall

https://fedorahosted.org/freeipa/ticket/5341
---
 ipaserver/install/server/common.py  | 5 +++++
 ipaserver/install/server/install.py | 8 +++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/ipaserver/install/server/common.py b/ipaserver/install/server/common.py
index 3eb7279d200ffd6ab33d8d914c8d4f13e567a171..6e15bded218dba2aa13d1e72423ee7256ad1e2a0 100644
--- a/ipaserver/install/server/common.py
+++ b/ipaserver/install/server/common.py
@@ -343,6 +343,11 @@ class BaseServer(common.Installable, common.Interactive, core.Composite):
         description="Do not automatically create DNS SSHFP records",
     )
 
+    force = Knob(
+        bool, False,
+        description="Force (un)install",
+    )
+
     def __init__(self, **kwargs):
         super(BaseServer, self).__init__(**kwargs)
 
diff --git a/ipaserver/install/server/install.py b/ipaserver/install/server/install.py
index 13a59a0e6149dc22ded4a895db02516e9360e02b..500c04c16e9230d8bf267ff294cdf03e74c3d3e0 100644
--- a/ipaserver/install/server/install.py
+++ b/ipaserver/install/server/install.py
@@ -954,6 +954,12 @@ def uninstall_check(installer):
 
     installer._installation_cleanup = False
 
+    if not options.force and not is_ipa_configured():
+        print("IPA server is not configured on this system.\n" +
+              "If you want to install the IPA server, please install " +
+              "it using 'ipa-server-install'.")
+        sys.exit(1)
+
     fstore = sysrestore.FileStore(SYSRESTORE_DIR_PATH)
     sstore = sysrestore.StateFile(SYSRESTORE_DIR_PATH)
 
@@ -1231,7 +1237,7 @@ class Server(BaseServer):
     dnssec_master = None
     disable_dnssec_master = None
     kasp_db_file = None
-    force = None
+    force = Knob(BaseServer.force)
 
     def __init__(self, **kwargs):
         super(Server, self).__init__(**kwargs)
-- 
1.8.3.1

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to