diff options
author | Sara Golemon <sara.golemon@mongodb.com> | 2019-02-12 22:14:59 +0000 |
---|---|---|
committer | Sara Golemon <sara.golemon@mongodb.com> | 2019-02-14 23:19:17 +0000 |
commit | 9d402c82594ad179d2b177027aec462422a4b4fa (patch) | |
tree | 87712d5ea54c57701141ed0fe842bffc0081323a /src/mongo/db | |
parent | 814b1f8237db9ecb27dd0ffa96f11edd58bac73e (diff) | |
download | mongo-9d402c82594ad179d2b177027aec462422a4b4fa.tar.gz |
SERVER-39501 Migrate windows options to IDL
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/SConscript | 11 | ||||
-rw-r--r-- | src/mongo/db/mongod_options.cpp | 12 | ||||
-rw-r--r-- | src/mongo/db/server_options_server_helpers.cpp | 49 | ||||
-rw-r--r-- | src/mongo/db/server_options_server_helpers.h | 17 | ||||
-rw-r--r-- | src/mongo/db/windows_options.idl | 76 |
5 files changed, 93 insertions, 72 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript index 86c80a6ab81..a15037350be 100644 --- a/src/mongo/db/SConscript +++ b/src/mongo/db/SConscript @@ -408,6 +408,17 @@ env.Library( ], ) +if env.TargetOSIs('windows'): + env.Library( + target='windows_options', + source=[ + env.Idlc('windows_options.idl')[0], + ], + LIBDEPS_PRIVATE=[ + '$BUILD_DIR/mongo/util/options_parser/options_parser', + ], + ) + env.Clone().InjectModule("enterprise").Library( target="server_options_servers", source=[ diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp index 6ef9cd82991..dc2df163205 100644 --- a/src/mongo/db/mongod_options.cpp +++ b/src/mongo/db/mongod_options.cpp @@ -63,15 +63,6 @@ Status addMongodOptions(moe::OptionSection* options) { return ret; } -#if defined(_WIN32) - moe::OptionSection windows_scm_options("Windows Service Control Manager options"); - - ret = addWindowsServerOptions(&windows_scm_options); - if (!ret.isOK()) { - return ret; - } -#endif - moe::OptionSection rs_options("Replica set options"); moe::OptionSection replication_options("Replication options"); moe::OptionSection sharding_options("Sharding options"); @@ -355,9 +346,6 @@ Status addMongodOptions(moe::OptionSection* options) { options->addSection(general_options).transitional_ignore(); -#if defined(_WIN32) - options->addSection(windows_scm_options).transitional_ignore(); -#endif options->addSection(replication_options).transitional_ignore(); options->addSection(rs_options).transitional_ignore(); options->addSection(sharding_options).transitional_ignore(); diff --git a/src/mongo/db/server_options_server_helpers.cpp b/src/mongo/db/server_options_server_helpers.cpp index 1e98b3c5299..4b836399e3a 100644 --- a/src/mongo/db/server_options_server_helpers.cpp +++ b/src/mongo/db/server_options_server_helpers.cpp @@ -63,6 +63,8 @@ using std::endl; using std::string; +namespace moe = ::mongo::optionenvironment; + namespace mongo { Status addGeneralServerOptions(moe::OptionSection* options) { @@ -298,53 +300,6 @@ Status addGeneralServerOptions(moe::OptionSection* options) { return Status::OK(); } -Status addWindowsServerOptions(moe::OptionSection* options) { - options->addOptionChaining("install", "install", moe::Switch, "install Windows service") - .setSources(moe::SourceAllLegacy); - - options->addOptionChaining("remove", "remove", moe::Switch, "remove Windows service") - .setSources(moe::SourceAllLegacy); - - options - ->addOptionChaining( - "reinstall", - "reinstall", - moe::Switch, - "reinstall Windows service (equivalent to --remove followed by --install)") - .setSources(moe::SourceAllLegacy); - - options->addOptionChaining("processManagement.windowsService.serviceName", - "serviceName", - moe::String, - "Windows service name"); - - options->addOptionChaining("processManagement.windowsService.displayName", - "serviceDisplayName", - moe::String, - "Windows service display name"); - - options->addOptionChaining("processManagement.windowsService.description", - "serviceDescription", - moe::String, - "Windows service description"); - - options->addOptionChaining("processManagement.windowsService.serviceUser", - "serviceUser", - moe::String, - "account for service execution"); - - options->addOptionChaining("processManagement.windowsService.servicePassword", - "servicePassword", - moe::String, - "password used to authenticate serviceUser"); - - options->addOptionChaining("service", "service", moe::Switch, "start mongodb service") - .hidden() - .setSources(moe::SourceAllLegacy); - - return Status::OK(); -} - namespace { // Helpers for option storage Status setupBinaryName(const std::vector<std::string>& argv) { diff --git a/src/mongo/db/server_options_server_helpers.h b/src/mongo/db/server_options_server_helpers.h index 03724ca7230..b6587c5379a 100644 --- a/src/mongo/db/server_options_server_helpers.h +++ b/src/mongo/db/server_options_server_helpers.h @@ -35,26 +35,17 @@ namespace mongo { -namespace optionenvironment { -class OptionSection; -class Environment; -} // namespace optionenvironment - -namespace moe = mongo::optionenvironment; - /** * General server options for most standalone applications. Includes addBaseServerOptions. */ -Status addGeneralServerOptions(moe::OptionSection* options); - -Status addWindowsServerOptions(moe::OptionSection* options); +Status addGeneralServerOptions(optionenvironment::OptionSection* options); /** * Handle custom validation of server options that can not currently be done by using * Constraints in the Environment. See the "validate" function in the Environment class for * more details. */ -Status validateServerOptions(const moe::Environment& params); +Status validateServerOptions(const optionenvironment::Environment& params); /** * Canonicalize server options for the given environment. @@ -62,7 +53,7 @@ Status validateServerOptions(const moe::Environment& params); * For example, the options "objcheck", "noobjcheck", and "net.wireObjectCheck" should all be * merged into "net.wireObjectCheck". */ -Status canonicalizeServerOptions(moe::Environment* params); +Status canonicalizeServerOptions(optionenvironment::Environment* params); /** * Sets up the global server state necessary to be able to store the server options, based on how @@ -78,7 +69,7 @@ Status setupServerOptions(const std::vector<std::string>& args); * * For example, sets the serverGlobalParams.port variable based on the net.port config parameter. */ -Status storeServerOptions(const moe::Environment& params); +Status storeServerOptions(const optionenvironment::Environment& params); void printCommandLineOpts(); diff --git a/src/mongo/db/windows_options.idl b/src/mongo/db/windows_options.idl new file mode 100644 index 00000000000..ebdc78042d1 --- /dev/null +++ b/src/mongo/db/windows_options.idl @@ -0,0 +1,76 @@ + +# Copyright (C) 2019-present MongoDB, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the Server Side Public License, version 1, +# as published by MongoDB, Inc. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# Server Side Public License for more details. +# +# You should have received a copy of the Server Side Public License +# along with this program. If not, see +# <http://www.mongodb.com/licensing/server-side-public-license>. +# +# As a special exception, the copyright holders give permission to link the +# code of portions of this program with the OpenSSL library under certain +# conditions as described in each individual source file and distribute +# linked combinations including the program with the OpenSSL library. You +# must comply with the Server Side Public License in all respects for +# all of the code used other than as permitted herein. If you modify file(s) +# with this exception, you may extend this exception to your version of the +# file(s), but you are not obligated to do so. If you do not wish to do so, +# delete this exception statement from your version. If you delete this +# exception statement from all source files in the program, then also delete +# it in the license file. +# + +global: + cpp_namespace: "mongo" + configs: + section: 'Windows Service Control Manager options' + source: [ yaml, cli, ini ] + +configs: + install: + description: 'Install Windows service' + arg_vartype: Switch + source: [ cli, ini ] + remove: + description: 'Remove Windows service' + arg_vartype: Switch + source: [ cli, ini ] + reinstall: + description: 'Reinstall Windows service (equivalent to --remove followed by --install)' + arg_vartype: Switch + source: [ cli, ini ] + service: + description: 'Start mongodb service' + arg_vartype: Switch + source: [ cli, ini ] + hidden: true + + 'processManagement.windowsService.serviceName': + description: 'Windows service name' + short_name: serviceName + arg_vartype: String + 'processManagement.windowsService.displayName': + description: 'Windows service display name' + short_name: serviceDisplayName + arg_vartype: String + 'processManagement.windowsService.description': + description: 'Windows service description' + short_name: serviceDescription + arg_vartype: String + 'processManagement.windowsService.serviceUser': + description: 'Account for service execution' + short_name: serviceUser + arg_vartype: String + 'processManagement.windowsService.servicePassword': + description: 'Password used to authenticate serviceUser' + short_name: servicePassword + arg_vartype: String + redact: true + |