Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-13595

Red Hat init.d script error: YAML config file parsing

    • Linux
    • Build Team 2.7.0, BUILD 2.7.1, BUILD 2.8.0-rc2

      In 2.6, MongoDB now supports YAML configuration files.

      The /etc/rc.d/init.d/mongod script in the mongodb-org RPM package doesn't work because of the following line that parses the pidfile path from the config file:

      PIDFILE=`awk -F= '/^pidfilepath[[:blank:]]*=[[:blank:]]*/{print $2}' "$CONFIGFILE"`
      

      The above line doesn't correctly parse YAML configuration files, so the init.d script is unable to retrieve the pidfile needed to stop the mongod service.

      The regex should be modified to cover both old and new style configuration files. The following works for YAML files:

      PIDFILE=`awk -F: '/^[[:blank:]]*pidFilePath[[:blank:]]*:[[:blank:]]*/{print $2}' "$CONFIGFILE" | tr -d ' '`
      

            Assignee:
            ernie.hershey@mongodb.com Ernie Hershey (Inactive)
            Reporter:
            jon.rangel@mongodb.com Jon Rangel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: