On Wed, 2011-04-27 at 10:59 -0400, Simo Sorce wrote:
> On Wed, 2011-04-27 at 16:17 +0200, Martin Kosek wrote:
> > The --force option may be misused to reinstall an existing IPA
> > client. This is not supported and may lead to unexpected errors.
> > When required, the cleanest way to re-install IPA client is to
> > run uninstall and then install again.
> > 
> > This patch also includes few cosmetic changes in "LDAP" term case
> > to provide more consistent experience with the script.
> > 
> > https://fedorahosted.org/freeipa/ticket/1117
> 
> Code looks good, but can you add to the last message advice about
> running --uninstall in case that's what the user is trying to do (a
> re-install)
> 
> Simo.
> 

Good idea. Updated patch attached.

Martin
>From 5a988b1aa00322e31a00e90eccd6971ea5bf124b Mon Sep 17 00:00:00 2001
From: Martin Kosek <mko...@redhat.com>
Date: Wed, 27 Apr 2011 16:09:43 +0200
Subject: [PATCH] Forbid reinstallation in ipa-client-install

The --force option may be misused to reinstall an existing IPA
client. This is not supported and may lead to unexpected errors.
When required, the cleanest way to re-install IPA client is to
run uninstall and then install again.

This patch also includes few cosmetic changes in messages to user
to provide more consistent user experience with the script.

https://fedorahosted.org/freeipa/ticket/1117
---
 install/tools/ipa-server-install          |    3 ++-
 ipa-client/ipa-install/ipa-client-install |   15 ++++++++-------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install
index bdce787d6a4c44ec325571fdb245dc39b1cb7d12..d50dc611b57f2e2366f9762e8c3ce0b864a3aeb5 100755
--- a/install/tools/ipa-server-install
+++ b/install/tools/ipa-server-install
@@ -494,7 +494,8 @@ def main():
         standard_logging_setup("/var/log/ipaserver-install.log", options.debug)
         print "\nThe log file for this installation can be found in /var/log/ipaserver-install.log"
         if (dsinstance.DsInstance().is_configured() or cainstance.CADSInstance().is_configured()) and not options.external_cert_file:
-            sys.exit("IPA server is already configured on this system.")
+            sys.exit("IPA server is already configured on this system.\n"
+                     + "If you want to reinstall the IPA server please uninstall it first.")
 
         client_fstore = sysrestore.FileStore('/var/lib/ipa-client/sysrestore')
         if client_fstore.has_files():
diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
index ca96e86f53de5f9b6d22731544c00b357eec2f4e..7ddea11f25ff1a8d3364c81da507e1f09536cb06 100755
--- a/ipa-client/ipa-install/ipa-client-install
+++ b/ipa-client/ipa-install/ipa-client-install
@@ -58,7 +58,7 @@ def parse_options():
     parser.add_option("--server", dest="server", help="IPA server")
     parser.add_option("--realm", dest="realm_name", help="realm name")
     parser.add_option("-f", "--force", dest="force", action="store_true",
-                      default=False, help="force setting of ldap/kerberos conf")
+                      default=False, help="force setting of LDAP/Kerberos conf")
     parser.add_option("-d", "--debug", dest="debug", action="store_true",
                       default=False, help="print debugging information")
     parser.add_option("-U", "--unattended", dest="unattended",
@@ -185,7 +185,7 @@ def chkconfig(name, status):
 
 def uninstall(options, env):
 
-    if not fstore.has_files() and not options.force:
+    if not fstore.has_files():
         print "IPA client is not configured on this system."
         return 2
 
@@ -265,11 +265,11 @@ def uninstall(options, env):
     except:
         print "Failed to clean up /etc/krb5.keytab"
 
-    print "Disabling client Kerberos and Ldap configurations"
+    print "Disabling client Kerberos and LDAP configurations"
     try:
         run(["/usr/sbin/authconfig", "--disableldap", "--disablekrb5", "--disablesssd", "--disablesssdauth", "--disablemkhomedir", "--update"])
     except Exception, e:
-        print "Failed to remove krb5/ldap configuration. " +str(e)
+        print "Failed to remove krb5/LDAP configuration. " +str(e)
         sys.exit(1)
 
     print "Restoring client configuration files"
@@ -563,7 +563,7 @@ def configure_sssd_conf(fstore, cli_realm, cli_domain, cli_server, options):
     return 0
 
 def resolve_ipaddress(server):
-    """ Connect to the server's ldap port in order to determine what ip
+    """ Connect to the server's LDAP port in order to determine what ip
         address this machine uses as "public" ip (relative to the server).
     """
 
@@ -672,8 +672,9 @@ def main():
     if options.uninstall:
         return uninstall(options, env)
 
-    if fstore.has_files() and not options.force:
-        sys.exit("IPA client is already configured on this system.")
+    if fstore.has_files():
+        sys.exit("IPA client is already configured on this system.\n"
+                + "If you want to reinstall the IPA client please uninstall it first.")
 
     cli_domain = None
     cli_server = None
-- 
1.7.4.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to