diff options
author | Andrew Bartlett <abartlet@samba.org> | 2009-01-14 20:31:58 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-01-19 12:16:24 +1100 |
commit | b7cafb98429f45e2aad10e683618da4626da5c84 (patch) | |
tree | 68fdce9450dc1d2b22cfff88620610811b1ac099 /source4/setup | |
parent | 44ae09b82e509db390ad4e884ae3310a3508cf46 (diff) | |
download | samba-b7cafb98429f45e2aad10e683618da4626da5c84.tar.gz samba-b7cafb98429f45e2aad10e683618da4626da5c84.tar.bz2 samba-b7cafb98429f45e2aad10e683618da4626da5c84.zip |
Don't give fatal python errors when guessing the realm
Diffstat (limited to 'source4/setup')
-rwxr-xr-x | source4/setup/provision | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source4/setup/provision b/source4/setup/provision index 55a438cb65..55535cfd4a 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: ") |