Free pyblijuju from relying on juju client when connecting to a controller #984
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This moves the computation of the
controller_name
from theconnector
to theController
class, to be lazily evaluated fromjujudata
(and cached). We can move it out of the connector safely because:1 -
controller_name
is not used within the connector.2 - the only location that the
controller_name
is returned to, ignores it.This has the nice consequence of freeing pylibjuju from relying on things like the
controllers.yaml
file (in turn the juju client to be installed) to connect to a controller.Fixes #983
QA Steps
Added a test for lazy computation of
controller_name
.But the scenario from the #983 can be tried easily as follows:
Now go move the
.local/share/juju/controllers.yaml
file temporarily.Should succeed without any errors.
Don't forget to move back your
controllers.yaml
back so nothing else on your machine freaks out.All CI tests need to pass.
Notes & Discussion
juju-4891