Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reinstalling an already existing plugin does not raise an error #99

Closed
Kolano opened this issue Mar 2, 2019 · 10 comments
Closed

Reinstalling an already existing plugin does not raise an error #99

Kolano opened this issue Mar 2, 2019 · 10 comments

Comments

@Kolano
Copy link

Kolano commented Mar 2, 2019

Describe the bug
I'm having trouble getting a custom DeepDispatcher working. I see similar errors trying to use the vt-search's DeepDispatcher so I'll describe that.

To Reproduce

  1. stoq scan file -E vt-search
  2. See exception

Expected behavior
No error. Since iocextract wasn't run before hand, standard no plug-in output.

Client (please complete the following information):

  • OS: Ubuntu 18.10
  • stoQ Version v2.0.3

Exception

Traceback (most recent call last):
  File "/home/pass/.stoq/.venv/bin/stoq", line 11, in <module>
    sys.exit(main())
  File "/home/pass/.stoq/.venv/lib/python3.6/site-packages/stoq/cli.py", line 261, in main
    plugin_dir_list=args.plugin_dir,
  File "/home/pass/.stoq/.venv/lib/python3.6/site-packages/stoq/core.py", line 431, in __init__
    d: self.load_plugin(d) for d in deep_dispatchers if d
  File "/home/pass/.stoq/.venv/lib/python3.6/site-packages/stoq/core.py", line 431, in <dictcomp>
    d: self.load_plugin(d) for d in deep_dispatchers if d
  File "/home/pass/.stoq/.venv/lib/python3.6/site-packages/stoq/plugin_manager.py", line 109, in load_plugin
    module_path, plugin_config = self._plugin_name_to_info[plugin_name]
KeyError: 'vt-search'
@mlaferrera
Copy link
Contributor

That error is saying that it can't find a vt-search plugin. I believe you are referring to vtmis-search. If you change your command to include that (so long as it is installed) it should run as expected.

@Kolano
Copy link
Author

Kolano commented Mar 4, 2019

Yeah, sorry. KeyError: <plugin name> isn't too helpful, a more descriptive exception there would be nice.

The similar error seen from my plugin seems to have been that I forgot to use the --upgrade switch on install, and had continued to use a broken iteration. I recall wanting to emulate pip, but I'm a little unsure why the extra switch is necessary, it might be good to provide a warning message there if a pre-existing plug-in exists and no change occurs due to the install command alone.

@mlaferrera
Copy link
Contributor

The --upgrade command implies you are upgrading the plugin. If you run stoq install without the --upgrade option, it will return an error letting you know the plugin already exists. If you still want to install the plugin you should do so with --upgrade. If you use --upgrade it will overwrite all of the plugins files, essentially reinstalling it if it's the same version. You can then run stoq list to view what plugins are available, along with their version.

@Kolano
Copy link
Author

Kolano commented Mar 4, 2019

But that's not what happens, the install command without --upgrade still provides the "Successfully installed to ..." message /w no error.

@Kolano Kolano changed the title Trouble with DeepDispatchers Errors for "No plugin matching name" and "Attempting to install pre-existing plugin" Mar 4, 2019
@mlaferrera
Copy link
Contributor

I'm going to need more than that to troubleshoot, preferably code. I just attempted to install a plugin using --upgrade and there are no issues. It overwrites the previous plugin.

@Kolano
Copy link
Author

Kolano commented Mar 4, 2019

But you had said it would error if "--upgrade" isn't used and it doesn't; it says it's installed sucessfully even though no overwrite occurs in that case.

@mlaferrera
Copy link
Contributor

Please provide code examples.

@Kolano
Copy link
Author

Kolano commented Mar 4, 2019

You can use your own code. Specifically...
stoq install ./vtmis-search
...if run against an install with vtmis-search previously installed, results in...
Successfully installed to /home/user/.stoq/plugins
...even though no installation occurs in that case. No error is output.

I also tried changing the version in setup.py to see if that had any impact, but it doesn't appear to, though a vtmis_search-2.0.2.dist-info directory is created or perhaps 2 since there is also a vtmis_search-2.0.1.dist-info directory now though that may have been from a prior attempt (a bit unclear when each was created, but noticing such doesn't appear for my other plug-ins which just have egg-info directories).

@mlaferrera
Copy link
Contributor

I see what you're saying. You're right, it doesn't appear to error out if the plugin already exists and no changes are made. I'll see what I can do to change that behavior in a future release.

@mlaferrera mlaferrera changed the title Errors for "No plugin matching name" and "Attempting to install pre-existing plugin" Reinstalling an already existing plugin does not raise an error Mar 4, 2019
@Kolano
Copy link
Author

Kolano commented Mar 4, 2019

Thanks. A more descriptive error when using a non-existent plug-in would also be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants