From b7cafb98429f45e2aad10e683618da4626da5c84 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 14 Jan 2009 20:31:58 +1100 Subject: [PATCH] Don't give fatal python errors when guessing the realm --- source4/setup/provision | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/source4/setup/provision b/source4/setup/provision index 55a438cb659..55535cfd4ac 100755 --- a/source4/setup/provision +++ b/source4/setup/provision @@ -129,8 +129,18 @@ if opts.interactive: else: print "%s: " % (prompt,), return sys.stdin.readline().rstrip("\n") or default - opts.realm = ask("Realm", socket.getfqdn().split(".", 1)[1].upper()) - opts.domain = ask("Domain", opts.realm.split(".")[0]) + try: + opts.realm = ask("Realm", socket.getfqdn().split(".", 1)[1].upper()) + except IndexError: + print >>sys.stderr, "Cannot guess realm from %s" % ( socket.getfqdn()) + sys.exit(1) + + try: + opts.domain = ask("Domain", opts.realm.split(".")[0]) + except IndexError: + print >>sys.stderr, "Cannot guess domain from %s" % ( opts.realm()) + sys.exit(1) + opts.server_role = ask("Server Role (dc, member, standalone)", "dc") for i in range(3): opts.adminpass = getpass("Administrator password: ") -- 2.11.4.GIT