summaryrefslogtreecommitdiffstats
path: root/ipa-client
diff options
context:
space:
mode:
authorMartin Nagy <mnagy@notas.(none)>2008-07-21 12:25:37 +0200
committerRob Crittenden <rcrit@ipa.greyoak.com>2008-07-23 10:05:06 -0400
commitf7ca405716b1ee8b92a940e07cd611f6b025795d (patch)
tree5246bd49daa8b72fe39f55d90b4280a8ec1d8b3e /ipa-client
parent72a3114a01d0c67cf3b8faf7b28da93e8a6f2de3 (diff)
downloadfreeipa-f7ca405716b1ee8b92a940e07cd611f6b025795d.tar.gz
freeipa-f7ca405716b1ee8b92a940e07cd611f6b025795d.tar.xz
freeipa-f7ca405716b1ee8b92a940e07cd611f6b025795d.zip
Wrap up the raw_input() to user_input() for convenience and uniformity.
Diffstat (limited to 'ipa-client')
-rw-r--r--ipa-client/ipa-install/ipa-client-install23
1 files changed, 6 insertions, 17 deletions
diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
index ecdf92740..eec36e4e3 100644
--- a/ipa-client/ipa-install/ipa-client-install
+++ b/ipa-client/ipa-install/ipa-client-install
@@ -30,7 +30,7 @@ try:
import ipaclient.ipadiscovery
import ipaclient.ipachangeconf
import ipaclient.ntpconf
- from ipa.ipautil import run
+ from ipa.ipautil import run, user_input
from ipa import sysrestore
from ipa import version
except ImportError:
@@ -70,13 +70,6 @@ def parse_options():
return options
-def ask_for_confirmation(message):
- yesno = raw_input(message + " [y/N]: ")
- if not yesno or yesno.lower()[0] != "y":
- return False
- print "\n"
- return True
-
def logging_setup(options):
# Always log everything (i.e., DEBUG) to the log
# file.
@@ -124,7 +117,7 @@ def uninstall(options):
print "The original nsswitch.conf configuration has been restored."
print "You may need to restart services or reboot the machine."
if not options.on_master:
- if ask_for_confirmation("Do you want to reboot the machine?"):
+ if user_input("Do you want to reboot the machine?", False):
try:
run(["/usr/bin/reboot"])
except Exception, e:
@@ -163,9 +156,7 @@ def main():
return ret
else:
print "DNS discovery failed to determine your DNS domain"
- cli_domain = ""
- while cli_domain == "":
- cli_domain = raw_input("Please provide the domain name of your IPA server (ex: example.com): ")
+ cli_domain = user_input("Please provide the domain name of your IPA server (ex: example.com)", allow_empty = False)
ret = ds.search(domain=cli_domain, server=options.server)
if not cli_domain:
if ds.getDomainName():
@@ -180,9 +171,7 @@ def main():
return ret
else:
print "DNS discovery failed to find the IPA Server"
- cli_server = ""
- while cli_server == "":
- cli_server = raw_input("Please provide your IPA server name (ex: ipa.example.com): ")
+ cli_server = user_input("Please provide your IPA server name (ex: ipa.example.com)", allow_empty = False)
ret = ds.search(domain=cli_domain, server=cli_server)
if not cli_server:
if ds.getServerName():
@@ -203,7 +192,7 @@ def main():
print "If you proceed with the installation, services will be configured to always"
print "access the discovered server for all operation and will not fail over to"
print "other servers in case of failure.\n"
- if not ask_for_confirmation("Do you want to proceed and configure the system with fixed values with no DNS discovery?"):
+ if not user_input("Do you want to proceed and configure the system with fixed values with no DNS discovery?", False):
return ret
if options.realm_name and options.realm_name != ds.getRealmName():
@@ -220,7 +209,7 @@ def main():
print "BaseDN: "+cli_basedn
print "\n"
- if not options.unattended and not ask_for_confirmation("Continue to configure the system with these values?"):
+ if not options.unattended and not user_input("Continue to configure the system with these values?", False):
return 1
# Configure ipa.conf