Plugin API fails with multiple juju binaries
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical Juju |
Fix Released
|
High
|
Unassigned |
Bug Description
No matter if I run 'juju1 wait' or 'juju2 wait' or 'juju wait', the juju-wait executable on the path is invoked. It has no idea which juju executable invoked it, so it has no idea what juju binary to use to actually do anything useful. It will likely run the wrong one, and fail.
One approach is to provide a way for the plugin to know which juju to use, such as an environment variable. This approach requires all plugins to be updated.
An alternative approach is to mess with the path, so the first 'juju' found in the $PATH is the correct one. This approach means many plugins will continue to work unmodified. Note that this could be done with a temporary directory and a symlink.
Yet another approach is to make juju(1) a thin wrapper that invokes the correct juju based on some user configuration (eg. an environment variable). This not only would fix the plugin API, but would also allow test suites, deployment scripts and CI systems to continue to work unmodified in many cases.
Changed in juju-core: | |
status: | New → Triaged |
importance: | Undecided → High |
milestone: | none → 2.0-beta4 |
Changed in juju-core: | |
milestone: | 2.0-beta4 → 2.0-rc1 |
Changed in juju-core: | |
milestone: | 2.0-beta5 → 2.0-rc1 |
Changed in juju-core: | |
status: | Triaged → Fix Released |
affects: | juju-core → juju |
Changed in juju: | |
milestone: | 2.0-beta6 → none |
milestone: | none → 2.0-beta6 |
As a work around, Python plugins can do the following to discover the juju executable and juju version in play by introspecting the parent process id:
import psutil Process( os.getppid( )).exe( ) check_output( [juju_exe, '--version'], universal_ newlines= True).strip( )
import subprocess
juju_exe = psutil.
juju_ver = subprocess.