Red Hat Bugzilla – Bug 486474
overriding arguments to setup causes setup to fail
Last modified: 2015-01-04 18:36:45 EST
According to a comment in the script, parameters in .inf files can be overridden on the command-line so:
setup-ds.pl -s -f /tmp/setup.inf slapd.ServerPort=1389
However, if setup.inf already contains ServerPort under [slapd], then init() in Setup.pm will create an array containing the old and the new value. This doesn't seem right, start up will fail because the value of nsslapd-port in dse.ldif will be literally "ARRAY(0x800000010003c858)".
Should setup really be turning the scalar into an array, saving the old value? I think the purpose of passing in an argument would be to either set if missing, or override if existing - not append. Or am I forgetting some setup parameter where we would want to append?
Created attachment 332643 [details]
trivial fix proposal
Created attachment 333059 [details]
Created attachment 333061 [details]
cvs commit log
Reviewed by: ulf.weltman, nkinder (Thanks!)
Fix Description: Parameters specified on the command line should override and replace (not add to) any parameters specified in a given .inf file. I refactored the code a little too - I moved the argv processing into the Inf module out of the Setup and Migration modules. The code will first process the args and store the values in a temporary hash ref. Then it will process the temp hash ref, replacing the values in the main inf with the values from the hash.
Platforms tested: RHEL4
Flag Day: no
Doc impact: no
Test is below, test result pass
< DS81rpm >[root@mv32a-vm ~]# setup-ds.pl -s -f ./mv32a.ds.ini slapd.ServerPort=1389
Your new DS instance 'mv32a-tmp' was successfully created.
Exiting . . .
Log file is '/tmp/setupoXO78H.log'
< DS81rpm >[root@mv32a-vm ~]# ps -elf | grep slapd
1 S nobody 2777 1 0 75 0 - 111180 stext 16:00 ? 00:00:00 ./ns-slapd -D /tmp/slapd-mv22a -i /tmp/slapd-mv22a/logs/slapd-mv32a-tmp.pid -w /tmp/slapd-mv22a/logs/slapd-mv32a-tmp.startpid
< DS81rpm >[root@mv32a-vm ~]# lsof -i TCP:2389
< DS81rpm >[root@mv32a-vm ~]# lsof -i TCP:1389
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
ns-slapd 2777 nobody 6u IPv6 9778 TCP *:iclpv-dm (LISTEN)
< DS81rpm >[root@mv32a-vm ~]# cat mv32a.ds.ini | grep -i serverport
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.