[SERVER-17337] RPM Init script breaks with quotes in yaml config file Created: 20/Feb/15  Updated: 05/Jan/18  Resolved: 25/Mar/15

Status: Closed
Project: Core Server
Component/s: Packaging
Affects Version/s: 3.0.0-rc8
Fix Version/s: 3.0.2, 3.1.1

Type: Bug Priority: Minor - P4
Reporter: Ernie Hershey Assignee: Ernie Hershey
Resolution: Done Votes: 1
Labels: build-planning
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
is duplicated by SERVER-17389 YAML pidFilePath not handled correctl... Closed
is duplicated by SERVER-17546 RHEL init.d script does not handle pi... Closed
is duplicated by SERVER-17952 init script for redhat can't stop the... Closed
Related
related to SERVER-16720 Init script in Red Hat fails if using... Closed
is related to SERVER-18060 init.d script for cents does not supp... Closed
Backwards Compatibility: Fully Compatible
Operating System: Linux
Backport Completed:
Sprint: BUILD 1 04/03/15
Participants:
Case:

 Description   

As pointed out here



 Comments   
Comment by Githook User [ 30/Mar/15 ]

Author:

{u'username': u'ehershey', u'name': u'Ernie Hershey', u'email': u'ernie.hershey@10gen.com'}

Message: SERVER-17337 Filter quote characters from RPM init script PIDFILEPATH and remove unused DBPATH

(cherry picked from commit 400dabd20809c561d8de21438d4bb7c682129641)
Branch: v3.0
https://github.com/mongodb/mongo/commit/e82fc79a0bd5cf5b93bbfa0b62e6ea05a5f607c7

Comment by Githook User [ 25/Mar/15 ]

Author:

{u'username': u'ehershey', u'name': u'Ernie Hershey', u'email': u'ernie.hershey@10gen.com'}

Message: SERVER-17337 Filter quote characters from RPM init script PIDFILEPATH and remove unused DBPATH
Branch: master
https://github.com/mongodb/mongo/commit/400dabd20809c561d8de21438d4bb7c682129641

Comment by Mitch McCracken [ 25/Mar/15 ]

i ran into this--what's worse is that it was creating a directory called " in my current path every time I started up a mongod instance because it thought it needed to create that pid directory.

Comment by Eric Milkie [ 26/Feb/15 ]

As far as using mongod to validate and parse a config, you can kind of do this today, but it's not ideal. You can start mongod with a combination of command line parameters and config file parameters, and then once the server is started you can fetch the parsed JSON config via getCmdLineOpts. This depends on the server being able to start, however.

Comment by Ernie Hershey [ 26/Feb/15 ]

I think a small change that would fix this would be to trim out quotes in these lines -

rpm/init.d-mongod:DBPATH=`awk -F'[:=]' -v IGNORECASE=1 '/^[[:blank:]]*(storage\.)?dbpath[[:blank:]]*[:=][[:blank:]]*/{print $2}' "$CONFIGFILE" | tr -d '[:blank:]'`
rpm/init.d-mongod:PIDFILEPATH=`awk -F'[:=]' -v IGNORECASE=1 '/^[[:blank:]]*(processManagement\.)?pidfilepath[[:blank:]]*[:=][[:blank:]]*/{print $2}' "$CONFIGFILE" | tr -d '[:blank:]'`

Replacing them with this:

rpm/init.d-mongod:DBPATH=`awk -F'[:=]' -v IGNORECASE=1 '/^[[:blank:]]*(storage\.)?dbpath[[:blank:]]*[:=][[:blank:]]*/{print $2}' "$CONFIGFILE" | tr -d "[:blank:]\"'"`
rpm/init.d-mongod:PIDFILEPATH=`awk -F'[:=]' -v IGNORECASE=1 '/^[[:blank:]]*(processManagement\.)?pidfilepath[[:blank:]]*[:=][[:blank:]]*/{print $2}' "$CONFIGFILE" | tr -d "[:blank:]\"'"`

Comment by Ernie Hershey [ 26/Feb/15 ]

That would be a good option although I worry about adding a dependency that might not be present on enough systems.

I was envisioning a way to call mongod or one of our tools to just spit out config options, since it's going to do the parsing ultimately anyways.

like if I run:

 mongod --parse-config=processManagement.pidFilePath


it would just echo the value and not do anything else.

Comment by Eric Milkie [ 20/Feb/15 ]

Is there a YAML parser we can use instead of trying to fake it with awk?

Generated at Thu Feb 08 03:44:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.