We have a default user name, which is also the recommended one, it made
no sense to force users to specify it at the command line for
unattended installations. Just use the default if none is provided.

Ticket #836

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York
>From fab7dcca35ea37a637ad1fcc741cb8986ec60da9 Mon Sep 17 00:00:00 2001
From: Simo Sorce <sso...@redhat.com>
Date: Mon, 24 Jan 2011 14:58:11 -0500
Subject: [PATCH] Make the -u option optional in unattended mode

Fixes: https://fedorahosted.org/freeipa/ticket/836
---
 install/tools/ipa-server-install |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install
index 37ded58d852b143b5c9cc91ad75281befe0b21f6..f1cab63f6ef7a7a34404b78d5f6cdb107aa9b3cb 100755
--- a/install/tools/ipa-server-install
+++ b/install/tools/ipa-server-install
@@ -58,6 +58,7 @@ from ipapython.ipautil import *
 from ipalib import api, errors, util
 from ipapython.config import IPAOptionParser
 
+DEF_DS_USER = 'dirsrv'
 
 pw_name = None
 uninstalling = False
@@ -154,9 +155,11 @@ def parse_options():
             options.admin_password or options.master_password):
             parser.error("In uninstall mode, -u, r and -P options are not allowed")
     elif options.unattended:
-        if (not options.ds_user or not options.realm_name or
+        if not options.ds_user:
+            options.ds_user = DEF_DS_USER
+        if (not options.realm_name or
             not options.dm_password or not options.admin_password):
-            parser.error("In unattended mode you need to provide at least -u, -r, -p and -a options")
+            parser.error("In unattended mode you need to provide at least -r, -p and -a options")
         if options.setup_dns:
             if not options.forwarders and not options.no_forwarders:
                 parser.error("You must specify at least one --forwarder option or --no-forwarders option")
@@ -313,19 +316,19 @@ def read_ds_user():
 
     ds_user = ""
     try:
-        pwd.getpwnam('dirsrv')
+        pwd.getpwnam(DEF_DS_USER)
 
-        print "A user account named 'dirsrv' already exists. This is the user id"
-        print "that the Directory Server will run as."
+        print "A user account named %s already exists." % DEF_DS_USER
+        print "This is the user id that the Directory Server will run as."
         print ""
-        if user_input("Do you want to use the existing 'dirsrv' account?", True):
-            ds_user = "dirsrv"
+        if user_input("Do you want to use the existing %s account?" % DEF_DS_USER, True):
+            ds_user = DEF_DS_USER
         else:
             print ""
             ds_user = user_input_plain("Which account name do you want to use for the DS instance?", allow_empty = False, allow_spaces = False)
         print ""
     except KeyError:
-        ds_user = "dirsrv"
+        ds_user = DEF_DS_USER
 
     return ds_user
 
-- 
1.7.3.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to