#1276 CLI plugin resolution occurs before pyver is honored
Closed: Fixed 4 years ago by mikem. Opened 5 years ago by cobrien.

The main koji cli script (/usr/bin/koji) loads its plugins, parses command-line options, and loads profile configuration from within the the get_options function.

Later if pyver was specified in the profile, koji will re-exec with the appropriate python version.

This results in a situation where any CLI plugins cannot be loaded if they are not in the default python version for the koji script, even when pyver is set.

For example, if the default environment is python 3, this means that even with pyver=2 specified command-line plugins under python 2 will not be available, as the get_options function will attempt to resolve the command using the python 3 koji_cli_plugins directory and will fail, citing "Unknown command" However, if you run koji help then the re-exec will happen, and the appropriate plugins will be loaded, and the help output will show the commands from the plugins.

So you can see them under help, but can never actually invoke them.

This is likely also an issue in reverse (ie. if the default koji bin is the python 2 one and you have plugins under python 3 and set pyver=3)


Thanks!

Plugins are loaded in get_options() before the command help bit (so that plugins appear there), whereas fix_pyver() is called in the main block after get_options() completes. I guess we could just move the fix_pyver() invocation, though we'd have to adjust the function since this is before logging is set up.

Metadata Update from @mikem:
- Issue set to the milestone: 1.18

5 years ago

Login to comment on this ticket.

Metadata