From aaa3cfd58ca0c62325d7637b67c6711660624f5d Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Thu, 17 Jan 2008 16:36:05 -0500 Subject: Fix case where a question was being asked in unattended mode. Catch permission errors on install. Initialize srv so the error message works if the user presses enter --- ipa-client/ipa-install/ipa-client-install | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install index 9cc6f6f6b..e499f0e40 100644 --- a/ipa-client/ipa-install/ipa-client-install +++ b/ipa-client/ipa-install/ipa-client-install @@ -43,6 +43,7 @@ def parse_options(): parser.add_option("-d", "--debug", dest="debug", action="store_true", default=False, help="print debugging information") parser.add_option("-U", "--unattended", dest="unattended", + action="store_true", help="unattended installation never prompts the user") parser.add_option("-N", "--no-ntp", action="store_false", help="do not configure ntp", default=True, dest="conf_ntp") @@ -86,6 +87,7 @@ def main(): ds = ipaclient.ipadiscovery.IPADiscovery() ret = ds.search() + srv = "" if ret == -10: print "Can't get the fully qualified name of this host" print "Please check that the client is properly configured" @@ -130,7 +132,7 @@ def main(): print "BaseDN: "+ds.getBaseDN() print "\n" - if not ask_for_confirmation("Continue to configure the system with these values?"): + if not options.unattended and not ask_for_confirmation("Continue to configure the system with these values?"): return 1 # Configure ipa.conf @@ -164,7 +166,11 @@ def main(): opts.append({'name':'uri', 'type':'option', 'value':'ldap://'+ds.getServerName()}) opts.append({'name':'empty', 'type':'empty'}) - ldapconf.newConf("/etc/ldap.conf", opts) + try: + ldapconf.newConf("/etc/ldap.conf", opts) + except Exception, e: + print "Configuration failed: " + str(e) + return 1 #Check if kerberos is already configured properly krbctx = krbV.default_context() @@ -232,6 +238,8 @@ def main(): if options.conf_ntp: ipaclient.ntpconf.config_ntp(ds.getServerName()) + print "Client configuration complete." + return 0 sys.exit(main()) -- cgit