Bug 486474 - overriding arguments to setup causes setup to fail
Summary: overriding arguments to setup causes setup to fail
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Directory Server
Classification: Red Hat
Component: Install/Uninstall
Version: 8.0
Hardware: All
OS: All
low
medium
Target Milestone: ---
: ---
Assignee: Rich Megginson
QA Contact: Chandrasekar Kannan
URL:
Whiteboard:
Depends On:
Blocks: 249650 FDS1.2.0
TreeView+ depends on / blocked
 
Reported: 2009-02-19 22:16 UTC by Ulf Weltman
Modified: 2015-01-04 23:36 UTC (History)
3 users (show)

Fixed In Version: 8.1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-04-29 23:10:42 UTC


Attachments (Terms of Use)
trivial fix proposal (1.60 KB, patch)
2009-02-19 22:19 UTC, Ulf Weltman
no flags Details | Diff
diffs (5.96 KB, patch)
2009-02-24 16:26 UTC, Rich Megginson
no flags Details | Diff
cvs commit log (551 bytes, text/plain)
2009-02-24 16:58 UTC, Rich Megginson
no flags Details

Description Ulf Weltman 2009-02-19 22:16:19 UTC
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?

Comment 1 Ulf Weltman 2009-02-19 22:19:49 UTC
Created attachment 332643 [details]
trivial fix proposal

Comment 2 Rich Megginson 2009-02-24 16:26:52 UTC
Created attachment 333059 [details]
diffs

Comment 3 Rich Megginson 2009-02-24 16:58:19 UTC
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

Comment 4 Yi Zhang 2009-04-07 23:16:52 UTC
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
ServerPort=              2389

Comment 5 Chandrasekar Kannan 2009-04-29 23:10:42 UTC
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.

http://rhn.redhat.com/errata/RHEA-2009-0455.html


Note You need to log in before you can comment on or make changes to this bug.