Mongosh breaks ps-entry.sh logic on Openshift

Description

Hi

branch: release-1.14.0
platform: Openshift

With mongosh introduction we came across unexpected issue on Openshift. Here is a bit modified ps-entry.sh output:

+ mongosh --norc --nodb --quiet --eval 'load('\''/js-yaml.js'\'','\''/fs.js'\''); JSON.stringify((jsyaml.load(fs.readFileSync("/etc/mongodb-config/mongod.conf",'\''utf8'\''))),null,2)' + cat /tmp/docker-entrypoint-config.json Warning: Could not access file: EACCES: permission denied, mkdir '/.mongodb' <<<< Error: Could not open history file. REPL session history will not be persisted. { "operationProfiling": { "mode": "slowOp", "slowOpThresholdMs": 100 }, "security": { "enableEncryption": true, "encryptionKeyFile": "/etc/mongodb-encryption/encryption-key", "redactClientLogData": false }, "setParameter": { "ttlMonitorSleepSecs": 60, "wiredTigerConcurrentReadTransactions": 128, "wiredTigerConcurrentWriteTransactions": 128 }, "storage": { "engine": "wiredTiger", "wiredTiger": { "collectionConfig": { "blockCompressor": "snappy" }, "engineConfig": { "directoryForIndexes": false, "journalCompressor": "snappy" }, "indexConfig": { "prefixCompression": true } } } } + jq 'del(.systemLog, .processManagement, .net, .security)' /tmp/docker-entrypoint-config.json parse error: Invalid numeric literal at line 1, column 8 + return 0 ++ jq -r '.net.tls.mode // "preferSSL"' /tmp/docker-entrypoint-config.json parse error: Invalid numeric literal at line 1, column 8 + tlsMode=

As you may notice, the parsed configuration file contains some errors from stdout/err and does not let further steps to succeed.
Please consider a fix for https://github.com/percona/percona-server-mongodb-operator/blob/release-1.14.0/build/ps-entry.sh#L218

P.S.: It could be fixed in a number of ways:

  • cut out some erroneous output of mongosh

  • Set a proper HOME for mongosh

  • etc

Environment

None

Activity

Done

Details

Assignee

Reporter

Found by Automation

Yes

Needs QA

Yes

Fix versions

Affects versions

Priority

Smart Checklist

Created February 27, 2023 at 6:15 PM
Updated March 5, 2024 at 4:32 PM
Resolved March 2, 2023 at 4:08 PM

Flag notifications