You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The argparse behavior requires mongod to be installed in PATH, otherwise the tool barfs.
Prior to parsing arguments, the MLaunchTool constructor requires getMongoDVersion() to return a valid value.
This exposes an underlying circular dependency between construction and argument parsing.
allowed arguments -> mongod version number -> binarypath argument
Expected behavior
The MLaunchTool should be capable of successfully running a few meta commands regardless of the existence of mongod in PATH.
e.g. The mtools version string gets printed or the help output of the script is printed
$ mlaunch --version
mtools version 1.7.0-dev || Python 3.9.2 (default, Jan 25 2022, 16:35:56) [GCC 7.5.0]
$ mlaunch --help
usage: mlaunch [-h] [--version] [--no-progressbar] {init,start,stop,restart,list,kill} ...
script to launch MongoDB stand-alone servers, replica sets and shards.
commands:
init is the default command and can be omitted. To get help on individual commands, run mlaunch <command> --help. Command line arguments which are not handled by mlaunch will be passed
through to mongod/mongos if those options are listed in the --help output for the current binary. For example: --storageEngine, --logappend, or --config.
{init,start,stop,restart,list,kill}
init initialize a new MongoDB environment and start stand-alone instances, replica sets, or sharded clusters.
start starts existing MongoDB instances. Example: "mlaunch start config" will start all config servers.
stop stops running MongoDB instances. Example: "mlaunch stop shard 2 secondary" will stop all secondary nodes of shard 2.
restart stops, then restarts MongoDB instances.
list list MongoDB instances of this environment.
kill kills (or sends another signal to) MongoDB instances of this environment.
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--no-progressbar disables progress bar
Actual/current behavior
$ mlaunch --version
Failed to launch mongod
Traceback (most recent call last):
File "/home/ubuntu/mongo/python3-venv/bin/mlaunch", line 33, in <module>
sys.exit(load_entry_point('mtools==1.7.0.dev0', 'console_scripts', 'mlaunch')())
File ".../mtools-1.7.0.dev0-py3.9.egg/mtools/mlaunch/mlaunch.py", line 2214, in main
tool = MLaunchTool()
File "/home/ubuntu/mongo/python3-venv/lib/python3.9/site-packages/mtools-1.7.0.dev0-py3.9.egg/mtools/mlaunch/mlaunch.py", line 198, in __init__
self.current_version = self.getMongoDVersion()
File ".../mtools-1.7.0.dev0-py3.9.egg/mtools/mlaunch/mlaunch.py", line 913, in getMongoDVersion
out = check_mongo_server_output(binary, '--version')
File "/home/ubuntu/mongo/python3-venv/lib/python3.9/site-packages/mtools-1.7.0.dev0-py3.9.egg/mtools/mlaunch/mlaunch.py", line 149, in check_mongo_server_output
raise exc
File ".../mtools-1.7.0.dev0-py3.9.egg/mtools/mlaunch/mlaunch.py", line 144, in check_mongo_server_output
proc = subprocess.Popen(['%s' % binary, argument],
File ".../stow/python3-v3.bmk/lib/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File ".../stow/python3-v3.bmk/lib/python3.9/subprocess.py", line 1823, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'mongod'
Steps to reproduce the actual/current behavior
Ensure mongod not in PATH
Install mtools
mlaunch --version or mlaunch --help
Environment
mtools version 1.7.0-dev || Python 3.9.2 (default, Jan 25 2022, 16:35:56) [GCC 7.5.0]
Software
Version
mtools
tip b96568cf
Python
3.9.2
MongoDB server
local install / tip
Operating system
Ubuntu 5.4.0-1059-aws
The text was updated successfully, but these errors were encountered:
The argparse behavior requires
mongod
to be installed inPATH
, otherwise the tool barfs.Prior to parsing arguments, the
MLaunchTool
constructor requiresgetMongoDVersion()
to return a valid value.This exposes an underlying circular dependency between construction and argument parsing.
allowed arguments -> mongod version number -> binarypath argument
Expected behavior
The MLaunchTool should be capable of successfully running a few meta commands regardless of the existence of
mongod
inPATH
.e.g. The mtools version string gets printed or the help output of the script is printed
Actual/current behavior
Steps to reproduce the actual/current behavior
mlaunch --version
ormlaunch --help
Environment
mtools version 1.7.0-dev || Python 3.9.2 (default, Jan 25 2022, 16:35:56) [GCC 7.5.0]
b96568cf
The text was updated successfully, but these errors were encountered: