Bug 1063659

Summary: init script does not respect options from /etc/sysconfig/mongod
Product: Red Hat OpenStack Reporter: Fabio Massimo Di Nitto <fdinitto>
Component: mongodbAssignee: Flavio Percoco <fpercoco>
Status: CLOSED ERRATA QA Contact: Lon Hohberger <lhh>
Severity: medium Docs Contact:
Priority: low    
Version: 4.0CC: ajeain, apevec, fpercoco, jpacner, lhh, scohen, slong, yeylon
Target Milestone: z3Keywords: OtherQA, Triaged, ZStream
Target Release: 4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: mongodb-2.2.4-6.el6ost Doc Type: Bug Fix
Doc Text:
Previously, the MongoDB initialisation script did not pick up system configuration because $OPTIONS was incorrectly specified in the `/etc/sysconfig/mongod` file. The script now correctly imports the MongoDB system configuration, and checks whether any of the environment configuration options have been set.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-03-25 19:23:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1066408, 1100411    
Attachments:
Description Flags
Tiny additional fix none

Description Fabio Massimo Di Nitto 2014-02-11 08:17:25 UTC
[root@rhos4-mongodb1 ~]# cat /etc/sysconfig/mongod  
OPTIONS="--quiet -f /etc/mongodb.conf"


[root@rhos4-mongodb1 ~]# grep -i options /etc/init.d/mongod 
options="$MONGODB_OPTIONS -f /etc/mongodb.conf"
    daemon --pidfile=${pidfile} --user mongodb "$exec --quiet $options run >> $logfile 2>&1 &"

as you can see, OPTIONS from mongod can never be applied to $options.

Also please note that --quiet is harcoded when spawning the daemon.

Comment 10 Lon Hohberger 2014-03-11 18:00:21 UTC
Starting mongodb with 2.2.4-5 fails; the logs contain:

error command line: multiple_occurrences
use --help for help

This is because the startup init script needs to be tweaked to not have "--quiet" since it's provided in $MONGODB_OPTIONS.

Comment 11 Lon Hohberger 2014-03-11 18:01:41 UTC
[root@rhos init.d]# mongod --quiet --quiet -f /etc/mongodb.conf run
error command line: multiple_occurrences
use --help for help

Comment 12 Lon Hohberger 2014-03-11 18:07:50 UTC
Created attachment 873217 [details]
Tiny additional fix

Comment 13 Lon Hohberger 2014-03-11 19:11:41 UTC
[root@rhos mongodb]# cat /etc/sysconfig/mongod
MONGODB_OPTIONS="--quiet -f /etc/mongodb.conf"
[root@rhos mongodb]# service mongod start
Starting mongod:                                           [  OK  ]
[root@rhos mongodb]# ps auwwx | grep mongo | grep -v grep
mongodb  14785  1.2  0.8 786604 34144 ?        Sl   15:07   0:00 /usr/bin/mongod --quiet -f /etc/mongodb.conf run
[root@rhos mongodb]# service mongod status
mongod (pid  14785) is running...
[root@rhos mongodb]# service mongod stop
Stopping mongod:                                           [  OK  ]
[root@rhos mongodb]# service mongod status
mongod is stopped

(change mongod)

[root@rhos mongodb]# cat /etc/sysconfig/mongod
MONGODB_OPTIONS="-f /etc/mongodb.conf"
[root@rhos mongodb]# service mongod start
Starting mongod:                                           [  OK  ]
[root@rhos mongodb]# ps auwwx | grep mongo | grep -v grep
mongodb  14974  1.1  0.8 786636 32564 ?        Sl   15:10   0:00 /usr/bin/mongod -f /etc/mongodb.conf run
[root@rhos mongodb]# service mongod status
mongod (pid  14974) is running...
[root@rhos mongodb]# service mongod stop
Stopping mongod:                                           [  OK  ]
[root@rhos mongodb]# service mongod status
mongod is stopped


I did not check upgrades.

Comment 15 errata-xmlrpc 2014-03-25 19:23:55 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-0334.html