summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Verch <shaun.verch@10gen.com>2013-10-24 11:24:19 -0400
committerShaun Verch <shaun.verch@10gen.com>2013-10-24 11:25:24 -0400
commitcfff07276553e9a4131a1699a9f58c3e6cb0b3b3 (patch)
tree8338cdc328e8dc8bbd9894d4055c38599c2f42d6
parente8fe7befcf2f698f988e0ac80a5b48ac51e6f922 (diff)
downloadmongo-cfff07276553e9a4131a1699a9f58c3e6cb0b3b3.tar.gz
SERVER-11144 Swap meaning of prevalidation return value and add comment
-rw-r--r--src/mongo/db/mongod_options.cpp8
-rw-r--r--src/mongo/db/mongod_options.h5
-rw-r--r--src/mongo/db/mongod_options_init.cpp2
-rw-r--r--src/mongo/dbtests/framework_options.cpp6
-rw-r--r--src/mongo/dbtests/framework_options.h5
-rw-r--r--src/mongo/dbtests/framework_options_init.cpp2
-rw-r--r--src/mongo/s/mongos_options.cpp8
-rw-r--r--src/mongo/s/mongos_options.h5
-rw-r--r--src/mongo/s/mongos_options_init.cpp2
-rw-r--r--src/mongo/shell/shell_options.cpp6
-rw-r--r--src/mongo/shell/shell_options.h5
-rw-r--r--src/mongo/shell/shell_options_init.cpp2
-rw-r--r--src/mongo/tools/bsondump_options.cpp4
-rw-r--r--src/mongo/tools/bsondump_options.h5
-rw-r--r--src/mongo/tools/bsondump_options_init.cpp2
-rw-r--r--src/mongo/tools/mongobridge_options.cpp4
-rw-r--r--src/mongo/tools/mongobridge_options.h5
-rw-r--r--src/mongo/tools/mongobridge_options_init.cpp2
-rw-r--r--src/mongo/tools/mongodump_options.cpp4
-rw-r--r--src/mongo/tools/mongodump_options.h5
-rw-r--r--src/mongo/tools/mongodump_options_init.cpp2
-rw-r--r--src/mongo/tools/mongoexport_options.cpp4
-rw-r--r--src/mongo/tools/mongoexport_options.h5
-rw-r--r--src/mongo/tools/mongoexport_options_init.cpp2
-rw-r--r--src/mongo/tools/mongofiles_options.cpp4
-rw-r--r--src/mongo/tools/mongofiles_options.h5
-rw-r--r--src/mongo/tools/mongofiles_options_init.cpp2
-rw-r--r--src/mongo/tools/mongoimport_options.cpp4
-rw-r--r--src/mongo/tools/mongoimport_options.h5
-rw-r--r--src/mongo/tools/mongoimport_options_init.cpp2
-rw-r--r--src/mongo/tools/mongooplog_options.cpp4
-rw-r--r--src/mongo/tools/mongooplog_options.h5
-rw-r--r--src/mongo/tools/mongooplog_options_init.cpp2
-rw-r--r--src/mongo/tools/mongorestore_options.cpp4
-rw-r--r--src/mongo/tools/mongorestore_options.h5
-rw-r--r--src/mongo/tools/mongorestore_options_init.cpp2
-rw-r--r--src/mongo/tools/mongostat_options.cpp4
-rw-r--r--src/mongo/tools/mongostat_options.h5
-rw-r--r--src/mongo/tools/mongostat_options_init.cpp2
-rw-r--r--src/mongo/tools/mongotop_options.cpp4
-rw-r--r--src/mongo/tools/mongotop_options.h5
-rw-r--r--src/mongo/tools/mongotop_options_init.cpp2
-rw-r--r--src/mongo/tools/tool_options.cpp4
-rw-r--r--src/mongo/tools/tool_options.h5
44 files changed, 125 insertions, 50 deletions
diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp
index 90dfc698b99..b07896abdbd 100644
--- a/src/mongo/db/mongod_options.cpp
+++ b/src/mongo/db/mongod_options.cpp
@@ -309,20 +309,20 @@ namespace mongo {
const std::vector<std::string>& args) {
if (params.count("help")) {
printMongodHelp(moe::startupOptions);
- return true;
+ return false;
}
if (params.count("version")) {
cout << mongodVersion() << endl;
printGitVersion();
printOpenSSLVersion();
- return true;
+ return false;
}
if (params.count("sysinfo")) {
sysRuntimeInfo();
- return true;
+ return false;
}
- return false;
+ return true;
}
Status storeMongodOptions(const moe::Environment& params,
diff --git a/src/mongo/db/mongod_options.h b/src/mongo/db/mongod_options.h
index 83498414c46..044caaeaf5c 100644
--- a/src/mongo/db/mongod_options.h
+++ b/src/mongo/db/mongod_options.h
@@ -58,6 +58,11 @@ namespace mongo {
void printMongodHelp(const moe::OptionSection& options);
+ /**
+ * Handle options that should come before validation, such as "help".
+ *
+ * Returns false if an option was found that implies we should prematurely exit with success.
+ */
bool handlePreValidationMongodOptions(const moe::Environment& params,
const std::vector<std::string>& args);
diff --git a/src/mongo/db/mongod_options_init.cpp b/src/mongo/db/mongod_options_init.cpp
index 61b242046a4..1ecd743c83b 100644
--- a/src/mongo/db/mongod_options_init.cpp
+++ b/src/mongo/db/mongod_options_init.cpp
@@ -37,7 +37,7 @@ namespace mongo {
}
MONGO_STARTUP_OPTIONS_VALIDATE(MongodOptions)(InitializerContext* context) {
- if (handlePreValidationMongodOptions(moe::startupOptionsParsed, context->args())) {
+ if (!handlePreValidationMongodOptions(moe::startupOptionsParsed, context->args())) {
::_exit(EXIT_SUCCESS);
}
Status ret = moe::startupOptionsParsed.validate();
diff --git a/src/mongo/dbtests/framework_options.cpp b/src/mongo/dbtests/framework_options.cpp
index 82f07068396..54a0ebefcfe 100644
--- a/src/mongo/dbtests/framework_options.cpp
+++ b/src/mongo/dbtests/framework_options.cpp
@@ -92,7 +92,7 @@ namespace mongo {
const std::vector<std::string>& args) {
if (params.count("help")) {
std::cout << getTestFrameworkHelp(args[0], moe::startupOptions) << std::endl;
- return true;
+ return false;
}
if (params.count("list")) {
@@ -102,10 +102,10 @@ namespace mongo {
std::cout << *i << std::endl;
}
- return true;
+ return false;
}
- return false;
+ return true;
}
Status storeTestFrameworkOptions(const moe::Environment& params,
diff --git a/src/mongo/dbtests/framework_options.h b/src/mongo/dbtests/framework_options.h
index 1bf6acccb9f..48ccfcda4de 100644
--- a/src/mongo/dbtests/framework_options.h
+++ b/src/mongo/dbtests/framework_options.h
@@ -45,6 +45,11 @@ namespace mongo {
std::string getTestFrameworkHelp(const StringData& name, const moe::OptionSection& options);
+ /**
+ * Handle options that should come before validation, such as "help".
+ *
+ * Returns false if an option was found that implies we should prematurely exit with success.
+ */
bool handlePreValidationTestFrameworkOptions(const moe::Environment& params,
const std::vector<std::string>& args);
diff --git a/src/mongo/dbtests/framework_options_init.cpp b/src/mongo/dbtests/framework_options_init.cpp
index 1198b2e81d3..02255881003 100644
--- a/src/mongo/dbtests/framework_options_init.cpp
+++ b/src/mongo/dbtests/framework_options_init.cpp
@@ -25,7 +25,7 @@ namespace mongo {
}
MONGO_STARTUP_OPTIONS_VALIDATE(FrameworkOptions)(InitializerContext* context) {
- if (handlePreValidationTestFrameworkOptions(moe::startupOptionsParsed, context->args())) {
+ if (!handlePreValidationTestFrameworkOptions(moe::startupOptionsParsed, context->args())) {
::_exit(EXIT_SUCCESS);
}
Status ret = moe::startupOptionsParsed.validate();
diff --git a/src/mongo/s/mongos_options.cpp b/src/mongo/s/mongos_options.cpp
index 1fbdbb61b27..aca0ed42374 100644
--- a/src/mongo/s/mongos_options.cpp
+++ b/src/mongo/s/mongos_options.cpp
@@ -114,20 +114,20 @@ namespace mongo {
const std::vector<std::string>& args) {
if (params.count("help")) {
printMongosHelp(moe::startupOptions);
- return true;
+ return false;
}
if (params.count("version")) {
printShardingVersionInfo(true);
- return true;
+ return false;
}
if ( params.count( "test" ) ) {
::mongo::logger::globalLogDomain()->setMinimumLoggedSeverity(
::mongo::logger::LogSeverity::Debug(5));
StartupTest::runTests();
- return true;
+ return false;
}
- return false;
+ return true;
}
Status storeMongosOptions(const moe::Environment& params,
diff --git a/src/mongo/s/mongos_options.h b/src/mongo/s/mongos_options.h
index f558d407509..ffc8f0a5022 100644
--- a/src/mongo/s/mongos_options.h
+++ b/src/mongo/s/mongos_options.h
@@ -42,6 +42,11 @@ namespace mongo {
void printMongosHelp(const moe::OptionSection& options);
+ /**
+ * Handle options that should come before validation, such as "help".
+ *
+ * Returns false if an option was found that implies we should prematurely exit with success.
+ */
bool handlePreValidationMongosOptions(const moe::Environment& params,
const std::vector<std::string>& args);
diff --git a/src/mongo/s/mongos_options_init.cpp b/src/mongo/s/mongos_options_init.cpp
index 2ead4f87d80..1f52354bce6 100644
--- a/src/mongo/s/mongos_options_init.cpp
+++ b/src/mongo/s/mongos_options_init.cpp
@@ -25,7 +25,7 @@ namespace mongo {
}
MONGO_STARTUP_OPTIONS_VALIDATE(MongosOptions)(InitializerContext* context) {
- if (handlePreValidationMongosOptions(moe::startupOptionsParsed, context->args())) {
+ if (!handlePreValidationMongosOptions(moe::startupOptionsParsed, context->args())) {
::_exit(EXIT_SUCCESS);
}
Status ret = moe::startupOptionsParsed.validate();
diff --git a/src/mongo/shell/shell_options.cpp b/src/mongo/shell/shell_options.cpp
index e344868064a..06fac35558c 100644
--- a/src/mongo/shell/shell_options.cpp
+++ b/src/mongo/shell/shell_options.cpp
@@ -121,13 +121,13 @@ namespace mongo {
const std::vector<std::string>& args) {
if (params.count("help")) {
std::cout << getMongoShellHelp(args[0], moe::startupOptions) << std::endl;
- return true;
+ return false;
}
if (params.count("version")) {
cout << "MongoDB shell version: " << mongo::versionString << endl;
- return true;
+ return false;
}
- return false;
+ return true;
}
Status storeMongoShellOptions(const moe::Environment& params,
diff --git a/src/mongo/shell/shell_options.h b/src/mongo/shell/shell_options.h
index 024af81a3d4..3ed2c0f9901 100644
--- a/src/mongo/shell/shell_options.h
+++ b/src/mongo/shell/shell_options.h
@@ -59,6 +59,11 @@ namespace mongo {
std::string getMongoShellHelp(const StringData& name, const moe::OptionSection& options);
+ /**
+ * Handle options that should come before validation, such as "help".
+ *
+ * Returns false if an option was found that implies we should prematurely exit with success.
+ */
bool handlePreValidationMongoShellOptions(const moe::Environment& params,
const std::vector<std::string>& args);
diff --git a/src/mongo/shell/shell_options_init.cpp b/src/mongo/shell/shell_options_init.cpp
index f1d7f991945..1db3f1c8f02 100644
--- a/src/mongo/shell/shell_options_init.cpp
+++ b/src/mongo/shell/shell_options_init.cpp
@@ -25,7 +25,7 @@ namespace mongo {
}
MONGO_STARTUP_OPTIONS_VALIDATE(MongoShellOptions)(InitializerContext* context) {
- if (handlePreValidationMongoShellOptions(moe::startupOptionsParsed, context->args())) {
+ if (!handlePreValidationMongoShellOptions(moe::startupOptionsParsed, context->args())) {
::_exit(EXIT_SUCCESS);
}
Status ret = moe::startupOptionsParsed.validate();
diff --git a/src/mongo/tools/bsondump_options.cpp b/src/mongo/tools/bsondump_options.cpp
index aa924c48e63..66961fef54f 100644
--- a/src/mongo/tools/bsondump_options.cpp
+++ b/src/mongo/tools/bsondump_options.cpp
@@ -56,9 +56,9 @@ namespace mongo {
bool handlePreValidationBSONDumpOptions(const moe::Environment& params) {
if (params.count("help")) {
printBSONDumpHelp(&std::cout);
- return true;
+ return false;
}
- return false;
+ return true;
}
Status storeBSONDumpOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/bsondump_options.h b/src/mongo/tools/bsondump_options.h
index 367e6d90d6b..37b84e9cec1 100644
--- a/src/mongo/tools/bsondump_options.h
+++ b/src/mongo/tools/bsondump_options.h
@@ -36,6 +36,11 @@ namespace mongo {
void printBSONDumpHelp(std::ostream* out);
+ /**
+ * Handle options that should come before validation, such as "help".
+ *
+ * Returns false if an option was found that implies we should prematurely exit with success.
+ */
bool handlePreValidationBSONDumpOptions(const moe::Environment& params);
Status storeBSONDumpOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/bsondump_options_init.cpp b/src/mongo/tools/bsondump_options_init.cpp
index eed5baa82bc..60baaacf531 100644
--- a/src/mongo/tools/bsondump_options_init.cpp
+++ b/src/mongo/tools/bsondump_options_init.cpp
@@ -25,7 +25,7 @@ namespace mongo {
}
MONGO_STARTUP_OPTIONS_VALIDATE(BSONDumpOptions)(InitializerContext* context) {
- if (handlePreValidationBSONDumpOptions(moe::startupOptionsParsed)) {
+ if (!handlePreValidationBSONDumpOptions(moe::startupOptionsParsed)) {
::_exit(EXIT_SUCCESS);
}
Status ret = moe::startupOptionsParsed.validate();
diff --git a/src/mongo/tools/mongobridge_options.cpp b/src/mongo/tools/mongobridge_options.cpp
index cfcc511cbf3..dc7ad9f60dc 100644
--- a/src/mongo/tools/mongobridge_options.cpp
+++ b/src/mongo/tools/mongobridge_options.cpp
@@ -52,9 +52,9 @@ namespace mongo {
bool handlePreValidationMongoBridgeOptions(const moe::Environment& params) {
if (params.count("help")) {
printMongoBridgeHelp(&std::cout);
- return true;
+ return false;
}
- return false;
+ return true;
}
Status storeMongoBridgeOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/mongobridge_options.h b/src/mongo/tools/mongobridge_options.h
index d962333f38b..3a51c1519ca 100644
--- a/src/mongo/tools/mongobridge_options.h
+++ b/src/mongo/tools/mongobridge_options.h
@@ -45,6 +45,11 @@ namespace mongo {
void printMongoBridgeHelp(std::ostream* out);
+ /**
+ * Handle options that should come before validation, such as "help".
+ *
+ * Returns false if an option was found that implies we should prematurely exit with success.
+ */
bool handlePreValidationMongoBridgeOptions(const moe::Environment& params);
Status storeMongoBridgeOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/mongobridge_options_init.cpp b/src/mongo/tools/mongobridge_options_init.cpp
index d966a27d7f5..cb1e45d120e 100644
--- a/src/mongo/tools/mongobridge_options_init.cpp
+++ b/src/mongo/tools/mongobridge_options_init.cpp
@@ -25,7 +25,7 @@ namespace mongo {
}
MONGO_STARTUP_OPTIONS_VALIDATE(MongoBridgeOptions)(InitializerContext* context) {
- if (handlePreValidationMongoBridgeOptions(moe::startupOptionsParsed)) {
+ if (!handlePreValidationMongoBridgeOptions(moe::startupOptionsParsed)) {
::_exit(EXIT_SUCCESS);
}
Status ret = moe::startupOptionsParsed.validate();
diff --git a/src/mongo/tools/mongodump_options.cpp b/src/mongo/tools/mongodump_options.cpp
index 806db39a0d3..801dc47418a 100644
--- a/src/mongo/tools/mongodump_options.cpp
+++ b/src/mongo/tools/mongodump_options.cpp
@@ -73,9 +73,9 @@ namespace mongo {
bool handlePreValidationMongoDumpOptions(const moe::Environment& params) {
if (params.count("help")) {
printMongoDumpHelp(&std::cout);
- return true;;
+ return false;;
}
- return false;
+ return true;
}
Status storeMongoDumpOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/mongodump_options.h b/src/mongo/tools/mongodump_options.h
index e0963ad2b98..cf00a6390df 100644
--- a/src/mongo/tools/mongodump_options.h
+++ b/src/mongo/tools/mongodump_options.h
@@ -39,6 +39,11 @@ namespace mongo {
void printMongoDumpHelp(std::ostream* out);
+ /**
+ * Handle options that should come before validation, such as "help".
+ *
+ * Returns false if an option was found that implies we should prematurely exit with success.
+ */
bool handlePreValidationMongoDumpOptions(const moe::Environment& params);
Status storeMongoDumpOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/mongodump_options_init.cpp b/src/mongo/tools/mongodump_options_init.cpp
index 189a9e59a2a..725a116c458 100644
--- a/src/mongo/tools/mongodump_options_init.cpp
+++ b/src/mongo/tools/mongodump_options_init.cpp
@@ -25,7 +25,7 @@ namespace mongo {
}
MONGO_STARTUP_OPTIONS_VALIDATE(MongoDumpOptions)(InitializerContext* context) {
- if (handlePreValidationMongoDumpOptions(moe::startupOptionsParsed)) {
+ if (!handlePreValidationMongoDumpOptions(moe::startupOptionsParsed)) {
::_exit(EXIT_SUCCESS);
}
Status ret = moe::startupOptionsParsed.validate();
diff --git a/src/mongo/tools/mongoexport_options.cpp b/src/mongo/tools/mongoexport_options.cpp
index ace4f2e8af4..e7c6e315f74 100644
--- a/src/mongo/tools/mongoexport_options.cpp
+++ b/src/mongo/tools/mongoexport_options.cpp
@@ -87,9 +87,9 @@ namespace mongo {
bool handlePreValidationMongoExportOptions(const moe::Environment& params) {
if (params.count("help")) {
printMongoExportHelp(&std::cout);
- return true;
+ return false;
}
- return false;
+ return true;
}
Status storeMongoExportOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/mongoexport_options.h b/src/mongo/tools/mongoexport_options.h
index d14d580a1f6..38343bd1f94 100644
--- a/src/mongo/tools/mongoexport_options.h
+++ b/src/mongo/tools/mongoexport_options.h
@@ -43,6 +43,11 @@ namespace mongo {
void printMongoExportHelp(std::ostream* out);
+ /**
+ * Handle options that should come before validation, such as "help".
+ *
+ * Returns false if an option was found that implies we should prematurely exit with success.
+ */
bool handlePreValidationMongoExportOptions(const moe::Environment& params);
Status storeMongoExportOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/mongoexport_options_init.cpp b/src/mongo/tools/mongoexport_options_init.cpp
index d18b0771716..1a9c9a1eeaf 100644
--- a/src/mongo/tools/mongoexport_options_init.cpp
+++ b/src/mongo/tools/mongoexport_options_init.cpp
@@ -25,7 +25,7 @@ namespace mongo {
}
MONGO_STARTUP_OPTIONS_VALIDATE(MongoExportOptions)(InitializerContext* context) {
- if (handlePreValidationMongoExportOptions(moe::startupOptionsParsed)) {
+ if (!handlePreValidationMongoExportOptions(moe::startupOptionsParsed)) {
::_exit(EXIT_SUCCESS);
}
Status ret = moe::startupOptionsParsed.validate();
diff --git a/src/mongo/tools/mongofiles_options.cpp b/src/mongo/tools/mongofiles_options.cpp
index 067a8b75533..216efbe6135 100644
--- a/src/mongo/tools/mongofiles_options.cpp
+++ b/src/mongo/tools/mongofiles_options.cpp
@@ -89,9 +89,9 @@ namespace mongo {
bool handlePreValidationMongoFilesOptions(const moe::Environment& params) {
if (params.count("help")) {
printMongoFilesHelp(&std::cout);
- return true;
+ return false;
}
- return false;
+ return true;
}
Status storeMongoFilesOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/mongofiles_options.h b/src/mongo/tools/mongofiles_options.h
index 009645a3eea..55b5710b672 100644
--- a/src/mongo/tools/mongofiles_options.h
+++ b/src/mongo/tools/mongofiles_options.h
@@ -39,6 +39,11 @@ namespace mongo {
void printMongoFilesHelp(std::ostream* out);
+ /**
+ * Handle options that should come before validation, such as "help".
+ *
+ * Returns false if an option was found that implies we should prematurely exit with success.
+ */
bool handlePreValidationMongoFilesOptions(const moe::Environment& params);
Status storeMongoFilesOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/mongofiles_options_init.cpp b/src/mongo/tools/mongofiles_options_init.cpp
index 9b6a5f9d9d3..8459ac651c6 100644
--- a/src/mongo/tools/mongofiles_options_init.cpp
+++ b/src/mongo/tools/mongofiles_options_init.cpp
@@ -25,7 +25,7 @@ namespace mongo {
}
MONGO_STARTUP_OPTIONS_VALIDATE(MongoFilesOptions)(InitializerContext* context) {
- if (handlePreValidationMongoFilesOptions(moe::startupOptionsParsed)) {
+ if (!handlePreValidationMongoFilesOptions(moe::startupOptionsParsed)) {
::_exit(EXIT_SUCCESS);
}
Status ret = moe::startupOptionsParsed.validate();
diff --git a/src/mongo/tools/mongoimport_options.cpp b/src/mongo/tools/mongoimport_options.cpp
index b14ddee8837..857802976c1 100644
--- a/src/mongo/tools/mongoimport_options.cpp
+++ b/src/mongo/tools/mongoimport_options.cpp
@@ -99,9 +99,9 @@ namespace mongo {
bool handlePreValidationMongoImportOptions(const moe::Environment& params) {
if (params.count("help")) {
printMongoImportHelp(&std::cout);
- return true;
+ return false;
}
- return false;
+ return true;
}
Status storeMongoImportOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/mongoimport_options.h b/src/mongo/tools/mongoimport_options.h
index 44f7ceaf48c..beaf20315b5 100644
--- a/src/mongo/tools/mongoimport_options.h
+++ b/src/mongo/tools/mongoimport_options.h
@@ -44,6 +44,11 @@ namespace mongo {
void printMongoImportHelp(std::ostream* out);
+ /**
+ * Handle options that should come before validation, such as "help".
+ *
+ * Returns false if an option was found that implies we should prematurely exit with success.
+ */
bool handlePreValidationMongoImportOptions(const moe::Environment& params);
Status storeMongoImportOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/mongoimport_options_init.cpp b/src/mongo/tools/mongoimport_options_init.cpp
index 054f1595c1b..8719e27b716 100644
--- a/src/mongo/tools/mongoimport_options_init.cpp
+++ b/src/mongo/tools/mongoimport_options_init.cpp
@@ -25,7 +25,7 @@ namespace mongo {
}
MONGO_STARTUP_OPTIONS_VALIDATE(MongoImportOptions)(InitializerContext* context) {
- if (handlePreValidationMongoImportOptions(moe::startupOptionsParsed)) {
+ if (!handlePreValidationMongoImportOptions(moe::startupOptionsParsed)) {
::_exit(EXIT_SUCCESS);
}
Status ret = moe::startupOptionsParsed.validate();
diff --git a/src/mongo/tools/mongooplog_options.cpp b/src/mongo/tools/mongooplog_options.cpp
index c72d7ab363a..c8e551805bf 100644
--- a/src/mongo/tools/mongooplog_options.cpp
+++ b/src/mongo/tools/mongooplog_options.cpp
@@ -66,9 +66,9 @@ namespace mongo {
bool handlePreValidationMongoOplogOptions(const moe::Environment& params) {
if (params.count("help")) {
printMongoOplogHelp(&std::cout);
- return true;
+ return false;
}
- return false;
+ return true;
}
Status storeMongoOplogOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/mongooplog_options.h b/src/mongo/tools/mongooplog_options.h
index 1a7095d5ed9..2fd7e6db6eb 100644
--- a/src/mongo/tools/mongooplog_options.h
+++ b/src/mongo/tools/mongooplog_options.h
@@ -37,6 +37,11 @@ namespace mongo {
void printMongoOplogHelp(std::ostream* out);
+ /**
+ * Handle options that should come before validation, such as "help".
+ *
+ * Returns false if an option was found that implies we should prematurely exit with success.
+ */
bool handlePreValidationMongoOplogOptions(const moe::Environment& params);
Status storeMongoOplogOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/mongooplog_options_init.cpp b/src/mongo/tools/mongooplog_options_init.cpp
index 85685872ce7..83d36098f8e 100644
--- a/src/mongo/tools/mongooplog_options_init.cpp
+++ b/src/mongo/tools/mongooplog_options_init.cpp
@@ -25,7 +25,7 @@ namespace mongo {
}
MONGO_STARTUP_OPTIONS_VALIDATE(MongoOplogOptions)(InitializerContext* context) {
- if (handlePreValidationMongoOplogOptions(moe::startupOptionsParsed)) {
+ if (!handlePreValidationMongoOplogOptions(moe::startupOptionsParsed)) {
::_exit(EXIT_SUCCESS);
}
Status ret = moe::startupOptionsParsed.validate();
diff --git a/src/mongo/tools/mongorestore_options.cpp b/src/mongo/tools/mongorestore_options.cpp
index 5153aa070a6..56dec027dcd 100644
--- a/src/mongo/tools/mongorestore_options.cpp
+++ b/src/mongo/tools/mongorestore_options.cpp
@@ -98,9 +98,9 @@ namespace mongo {
bool handlePreValidationMongoRestoreOptions(const moe::Environment& params) {
if (params.count("help")) {
printMongoRestoreHelp(&std::cout);
- return true;
+ return false;
}
- return false;
+ return true;
}
Status storeMongoRestoreOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/mongorestore_options.h b/src/mongo/tools/mongorestore_options.h
index 5501fe1d22e..67371382354 100644
--- a/src/mongo/tools/mongorestore_options.h
+++ b/src/mongo/tools/mongorestore_options.h
@@ -42,6 +42,11 @@ namespace mongo {
void printMongoRestoreHelp(std::ostream* out);
+ /**
+ * Handle options that should come before validation, such as "help".
+ *
+ * Returns false if an option was found that implies we should prematurely exit with success.
+ */
bool handlePreValidationMongoRestoreOptions(const moe::Environment& params);
Status storeMongoRestoreOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/mongorestore_options_init.cpp b/src/mongo/tools/mongorestore_options_init.cpp
index f03c9ea531a..bef0f3ee2e4 100644
--- a/src/mongo/tools/mongorestore_options_init.cpp
+++ b/src/mongo/tools/mongorestore_options_init.cpp
@@ -25,7 +25,7 @@ namespace mongo {
}
MONGO_STARTUP_OPTIONS_VALIDATE(MongoRestoreOptions)(InitializerContext* context) {
- if (handlePreValidationMongoRestoreOptions(moe::startupOptionsParsed)) {
+ if (!handlePreValidationMongoRestoreOptions(moe::startupOptionsParsed)) {
::_exit(EXIT_SUCCESS);
}
Status ret = moe::startupOptionsParsed.validate();
diff --git a/src/mongo/tools/mongostat_options.cpp b/src/mongo/tools/mongostat_options.cpp
index d57637b21c6..5ca3e7dddab 100644
--- a/src/mongo/tools/mongostat_options.cpp
+++ b/src/mongo/tools/mongostat_options.cpp
@@ -97,9 +97,9 @@ namespace mongo {
bool handlePreValidationMongoStatOptions(const moe::Environment& params) {
if (params.count("help")) {
printMongoStatHelp(&std::cout);
- return true;
+ return false;
}
- return false;
+ return true;
}
Status storeMongoStatOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/mongostat_options.h b/src/mongo/tools/mongostat_options.h
index d0a7180cfaf..e9b980c881e 100644
--- a/src/mongo/tools/mongostat_options.h
+++ b/src/mongo/tools/mongostat_options.h
@@ -42,6 +42,11 @@ namespace mongo {
void printMongoStatHelp(std::ostream* out);
+ /**
+ * Handle options that should come before validation, such as "help".
+ *
+ * Returns false if an option was found that implies we should prematurely exit with success.
+ */
bool handlePreValidationMongoStatOptions(const moe::Environment& params);
Status storeMongoStatOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/mongostat_options_init.cpp b/src/mongo/tools/mongostat_options_init.cpp
index e706f397327..e3105479e9c 100644
--- a/src/mongo/tools/mongostat_options_init.cpp
+++ b/src/mongo/tools/mongostat_options_init.cpp
@@ -25,7 +25,7 @@ namespace mongo {
}
MONGO_STARTUP_OPTIONS_VALIDATE(MongoStatOptions)(InitializerContext* context) {
- if (handlePreValidationMongoStatOptions(moe::startupOptionsParsed)) {
+ if (!handlePreValidationMongoStatOptions(moe::startupOptionsParsed)) {
::_exit(EXIT_SUCCESS);
}
Status ret = moe::startupOptionsParsed.validate();
diff --git a/src/mongo/tools/mongotop_options.cpp b/src/mongo/tools/mongotop_options.cpp
index c629ec6c64a..55d5a20db62 100644
--- a/src/mongo/tools/mongotop_options.cpp
+++ b/src/mongo/tools/mongotop_options.cpp
@@ -55,9 +55,9 @@ namespace mongo {
bool handlePreValidationMongoTopOptions(const moe::Environment& params) {
if (params.count("help")) {
printMongoTopHelp(&std::cout);
- return true;
+ return false;
}
- return false;
+ return true;
}
Status storeMongoTopOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/mongotop_options.h b/src/mongo/tools/mongotop_options.h
index e88403acd01..150cc287f91 100644
--- a/src/mongo/tools/mongotop_options.h
+++ b/src/mongo/tools/mongotop_options.h
@@ -36,6 +36,11 @@ namespace mongo {
void printMongoTopHelp(std::ostream* out);
+ /**
+ * Handle options that should come before validation, such as "help".
+ *
+ * Returns false if an option was found that implies we should prematurely exit with success.
+ */
bool handlePreValidationMongoTopOptions(const moe::Environment& params);
Status storeMongoTopOptions(const moe::Environment& params,
diff --git a/src/mongo/tools/mongotop_options_init.cpp b/src/mongo/tools/mongotop_options_init.cpp
index 7b4c9961444..1cf5d19da19 100644
--- a/src/mongo/tools/mongotop_options_init.cpp
+++ b/src/mongo/tools/mongotop_options_init.cpp
@@ -25,7 +25,7 @@ namespace mongo {
}
MONGO_STARTUP_OPTIONS_VALIDATE(MongoTopOptions)(InitializerContext* context) {
- if (handlePreValidationMongoTopOptions(moe::startupOptionsParsed)) {
+ if (!handlePreValidationMongoTopOptions(moe::startupOptionsParsed)) {
::_exit(EXIT_SUCCESS);
}
Status ret = moe::startupOptionsParsed.validate();
diff --git a/src/mongo/tools/tool_options.cpp b/src/mongo/tools/tool_options.cpp
index e623ca9dd54..132c0d64d7c 100644
--- a/src/mongo/tools/tool_options.cpp
+++ b/src/mongo/tools/tool_options.cpp
@@ -181,9 +181,9 @@ namespace mongo {
bool handlePreValidationGeneralToolOptions(const moe::Environment& params) {
if (moe::startupOptionsParsed.count("version")) {
printToolVersionString(std::cout);
- return true;
+ return false;
}
- return false;
+ return true;
}
extern bool directoryperdb;
diff --git a/src/mongo/tools/tool_options.h b/src/mongo/tools/tool_options.h
index 346b3bd4d10..1505861a783 100644
--- a/src/mongo/tools/tool_options.h
+++ b/src/mongo/tools/tool_options.h
@@ -88,6 +88,11 @@ namespace mongo {
int getParam(std::string name, int def);
bool hasParam(std::string name);
+ /**
+ * Handle options that should come before validation, such as "help".
+ *
+ * Returns false if an option was found that implies we should prematurely exit with success.
+ */
bool handlePreValidationGeneralToolOptions(const moe::Environment& params);
Status storeGeneralToolOptions(const moe::Environment& params,