summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Verch <shaun.verch@mongodb.com>2014-03-27 19:28:27 -0400
committerShaun Verch <shaun.verch@mongodb.com>2014-03-28 13:49:44 -0400
commitf81b9676fa3dac6aa24c03a0a97ee4b74e352706 (patch)
treecf58e91107b9f91868bc5eb7e59e37c72f304308
parent1b9917b39c4fa37fd2a5e42c78e5f1e50c4c50cc (diff)
downloadmongo-f81b9676fa3dac6aa24c03a0a97ee4b74e352706.tar.gz
SERVER-13379 Canonicalize nounixsocket as net.unixDomainSocket.enabled
(cherry picked from commit 9f0e88d0a4c00c125ce52d3954503dd1c91eae7c)
-rw-r--r--jstests/core/network_options.js39
-rw-r--r--jstests/libs/config_files/enable_unixsocket.json7
-rw-r--r--src/mongo/db/server_options_helpers.cpp19
3 files changed, 59 insertions, 6 deletions
diff --git a/jstests/core/network_options.js b/jstests/core/network_options.js
index 939df5cfbce..6c192f3f68f 100644
--- a/jstests/core/network_options.js
+++ b/jstests/core/network_options.js
@@ -143,4 +143,43 @@ expectedResult = {
};
testGetCmdLineOpts({}, expectedResult);
+
+
+// Unix Socket
+if (!_isWindows()) {
+ jsTest.log("Testing \"nounixsocket\" command line option");
+ expectedResult = {
+ "parsed" : {
+ "net" : {
+ "unixDomainSocket" : {
+ "enabled" : false
+ }
+ }
+ }
+ };
+ testGetCmdLineOpts({ nounixsocket : "" }, expectedResult);
+
+ jsTest.log("Testing \"net.wireObjectCheck\" config file option");
+ expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/enable_unixsocket.json",
+ "net" : {
+ "unixDomainSocket" : {
+ "enabled" : true
+ }
+ }
+ }
+ };
+ testGetCmdLineOpts({ config : "jstests/libs/config_files/enable_unixsocket.json" },
+ expectedResult);
+
+ jsTest.log("Testing with no explicit network option setting");
+ expectedResult = {
+ "parsed" : {
+ "net" : { }
+ }
+ };
+ testGetCmdLineOpts({}, expectedResult);
+}
+
print(baseName + " succeeded.");
diff --git a/jstests/libs/config_files/enable_unixsocket.json b/jstests/libs/config_files/enable_unixsocket.json
new file mode 100644
index 00000000000..660d21eb17f
--- /dev/null
+++ b/jstests/libs/config_files/enable_unixsocket.json
@@ -0,0 +1,7 @@
+{
+ "net" : {
+ "unixDomainSocket" : {
+ "enabled" : true
+ }
+ }
+}
diff --git a/src/mongo/db/server_options_helpers.cpp b/src/mongo/db/server_options_helpers.cpp
index 05d508f977f..c3285616a26 100644
--- a/src/mongo/db/server_options_helpers.cpp
+++ b/src/mongo/db/server_options_helpers.cpp
@@ -440,6 +440,19 @@ namespace {
}
}
+ // "net.unixDomainSocket.enabled" comes from the config file, so override it if
+ // "nounixsocket" is set since that comes from the command line.
+ if (params->count("nounixsocket")) {
+ Status ret = params->set("net.unixDomainSocket.enabled", moe::Value(false));
+ if (!ret.isOK()) {
+ return ret;
+ }
+ ret = params->remove("nounixsocket");
+ if (!ret.isOK()) {
+ return ret;
+ }
+ }
+
return Status::OK();
}
@@ -599,16 +612,10 @@ namespace {
serverGlobalParams.socket = params["net.unixDomainSocket.pathPrefix"].as<string>();
}
- // --nounixsocket is checked after this since net.unixDomainSocket.enabled is from the
- // config file and the command line should override the config file
if (params.count("net.unixDomainSocket.enabled")) {
serverGlobalParams.noUnixSocket = !params["net.unixDomainSocket.enabled"].as<bool>();
}
- if (params.count("nounixsocket")) {
- serverGlobalParams.noUnixSocket = true;
- }
-
if (params.count("processManagement.fork") && !params.count("shutdown")) {
serverGlobalParams.doFork = true;
}