You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Kevin Klues <kl...@gmail.com> on 2017/05/02 22:48:58 UTC

Re: Review Request 57952: Added 'config' plugin to the new CLI.

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/57952/#review173666
-----------------------------------------------------------



As part of this patch , I expected `main.py` to be updated to explicitly load only the config plugin and then have the config plugin load the real set of plugins and pass them back to main. I.e. per our discussion on slack:

```
Maybe the right answer is to:
1) Move all TOML file parsing / validation out of settings.py and into the config plugin
2) Have main() explicitly instantiate the Config plugin by name
3) Replace the following call in `main()` from:
    # Initialize the various plugins.
    plugins = mesos.util.import_modules(settings.PLUGINS, "plugins")

to
    plugins = ConfigPlugin(settings).plugins([])

3) The `ConfigPlugin.plugins()` command will then be in charge running `mesos.util.import_modules(plugins, "plugins")` over all plugins (both builtin and those found in the TOML file) to validate that they are importable and then return their loaded modules.
4) The main function would then process as before from there (edited)

[16:41] 
When `mesos config plugins` is invoked by the user, it can print out, e.g.:
NAME        DESCRIPTION
agent       Agent specific commands for the Mesos CLI
cluster     Cluster specific commands for the Mesos CLI
container   Container specific commands for the Mesos CLI

which it can parse from the loaded modules from `PLUGIN_NAME` and `SHORT_HELP` (edited)

[16:44] 
or if there is an error with loading one of the plugins it can raise a CLIExpection() with a meaningful error message
```

- Kevin Klues


On April 12, 2017, 9:19 a.m., Armand Grillet wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/57952/
> -----------------------------------------------------------
> 
> (Updated April 12, 2017, 9:19 a.m.)
> 
> 
> Review request for mesos, Joseph Wu and Kevin Klues.
> 
> 
> Bugs: MESOS-7269
>     https://issues.apache.org/jira/browse/MESOS-7269
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Used to show the plugins available for the user.
> 
> 
> Diffs
> -----
> 
>   src/cli_new/bin/settings.py 2f6162edc1722054bc44ad25956e6fe666d36c7f 
>   src/cli_new/lib/cli/plugins/config/__init__.py PRE-CREATION 
>   src/cli_new/lib/cli/plugins/config/main.py PRE-CREATION 
> 
> 
> Diff: https://reviews.apache.org/r/57952/diff/6/
> 
> 
> Testing
> -------
> 
> Tested manually, PEP8 and Pylint used to make sure that the code style is correct.
> 
> 
> Thanks,
> 
> Armand Grillet
> 
>