[SERVER-18877] Allow MongoRunner.runMongod Take In Environment Variables Created: 08/Jun/15  Updated: 29/Aug/16  Resolved: 03/May/16

Status: Closed
Project: Core Server
Component/s: Shell, Testing Infrastructure
Affects Version/s: None
Fix Version/s: 3.3.6

Type: Improvement Priority: Major - P3
Reporter: Robert Guo (Inactive) Assignee: Spencer Jackson
Resolution: Done Votes: 0
Labels: 32qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-22161 Test LDAP Authorization bind mechanisms Closed
Related
related to SERVER-4895 Expose environment variables in the s... Closed
is related to SERVER-25840 Ability for runProgram() to specify e... Closed
Backwards Compatibility: Fully Compatible
Sprint: Security 6 07/17/15, Security 7 08/10/15, Security 12 (04/01/16), Security 13 (04/22/16), Security 14 (05/13/16)
Participants:

 Description   

Currently it's possible to set environment variables when starting a mongod from the mongo shell in the following fashion.

_startMongoProgram("env", "ABCD=123", "mongo", "--nodb");

MongoRunner.runMongod should be able to take in environment variables as options and format it as environment variables to _startMongoProgram. This would enable shardingtest, replsettest and possibly other higher-level abstractions that use runMongod to also take in environment variables in their options.



 Comments   
Comment by Githook User [ 03/May/16 ]

Author:

{u'username': u'spencerjackson', u'name': u'Spencer Jackson', u'email': u'spencer.jackson@mongodb.com'}

Message: SERVER-18877: Spawn process with environment variables
Branch: master
https://github.com/mongodb/mongo/commit/67fbb57210c9f22b03aacc777364cf8ed8cef5d2

Comment by Kevin Pulo [ 02/Mar/16 ]

Another way of fixing this problem would be if SERVER-4895 was to be implemented. Then MongoRunner could use those functions to adjust the shell's environment prior to spawning the sub-process.

Comment by Robert Guo (Inactive) [ 09/Jun/15 ]

Thanks for the tip kevin.pulo@10gen.com. This should work great!

Comment by Kevin Pulo [ 09/Jun/15 ]

A workaround for the current _startMongoProgram is to use the POSIX env utility, eg.

_startMongoProgram("env", "ABCD=123", "mongo", "--nodb");

Doesn't help for non-POSIX systems like Windows though.

Comment by Robert Guo (Inactive) [ 08/Jun/15 ]

schwerin Set by the shell on the runner. I modified the description to clarify.

Comment by Andy Schwerin [ 08/Jun/15 ]

Environment variables from the shell's environment, or set by the shell on the runner?

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