diff options
author | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-11-28 17:03:57 +0100 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-11-28 18:59:33 +0100 |
commit | f0686645a99de226f199130fee07910d0f6462be (patch) | |
tree | 25f40d7ee85042757b091f715539c9d61f42c17e | |
parent | 3ca61d9a011d5e8ff677df041f4afb4c3a8be0b4 (diff) | |
download | samba-f0686645a99de226f199130fee07910d0f6462be.tar.gz samba-f0686645a99de226f199130fee07910d0f6462be.tar.bz2 samba-f0686645a99de226f199130fee07910d0f6462be.zip |
s4:setup/provision - Rework
- Revert change in "ask" - was previously correct
- Readd accidentally removed checks for non-null realm and domainname
- On interactive mode perform only one "ask" call per question
- Inform the user about the unset administrator password
-rwxr-xr-x | source4/setup/provision | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/source4/setup/provision b/source4/setup/provision index f1aa07c7a7..b855dc2f30 100755 --- a/source4/setup/provision +++ b/source4/setup/provision @@ -129,17 +129,25 @@ if opts.interactive: if default is not None: print "%s [%s]: " % (prompt,default), else: - print "%s: " % (prompt), + print "%s: " % (prompt,), return sys.stdin.readline().rstrip("\n") or default try: - opts.realm = ask("Realm", socket.getfqdn().split(".", 1)[1].upper()) + default = socket.getfqdn().split(".", 1)[1].upper() except IndexError: - opts.realm = ask("Realm", None) + default = None + opts.realm = ask("Realm", default) + if opts.realm in (None, ""): + print >>sys.stderr, "No realm set!" + sys.exit(1) try: - opts.domain = ask("Domain", opts.realm.split(".")[0]) + default = opts.realm.split(".")[0] except IndexError: - opts.domain = ask("Domain", None) + default = None + opts.domain = ask("Domain", default) + if opts.domain is None: + print >> sys.stderr, "No domain set!" + sys.exit(1) opts.server_role = ask("Server Role (dc, member, standalone)", "dc") for i in range(3): @@ -148,6 +156,17 @@ if opts.interactive: print >>sys.stderr, "Invalid administrator password." else: break +else: + if opts.realm is None or opts.domain is None: + if opts.realm is None: + print >>sys.stderr, "No realm set!" + if opts.domain is None: + print >> sys.stderr, "No domain set!" + parser.print_usage() + sys.exit(1) + +if not opts.adminpass: + message("Administrator password will be set randomly!") lp = sambaopts.get_loadparm() smbconf = lp.configfile |