-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Hello!
I was wondering the rationale behind some of the design decisions in the library which isn't quite documented.
Firstly, the temp_model and the controller argument
It is easy to use the Juju fixture like so:
@pytest_asyncio.fixture(scope="module", name="juju")
def juju_fixture(request: pytest.FixtureRequest) -> Generator[jubilant.Juju, None, None]:
"""The machine model for machine charms."""
with jubilant.temp_model(controller=LXD_CONTROLLER_NAME) as juju:
yield juju
@pytest_asyncio.fixture(scope="module", name="k8s_juju")
def k8s_juju_fixture(request: pytest.FixtureRequest) -> Generator[jubilant.Juju, None, None]:
"""The model for K8s charms."""
with jubilant.temp_model(controller=MICROK8S_CONTROLLER_NAME) as juju:
yield juju
Here, we see that the temp_model takes in the argument controller. Since doing so, I have assumed that the controller information would be persisted. However, that is not the case. Using k8s_juju to create offers when the current controller is on the lxd makes the k8s_juju work on the LXD Juju.
Secondly, the prefixed controller name in model attribute.
When accessing the juju.model the syntax output is <controller>:<model> when the model is in another controller. I would expect the juju class to have a separate controller attribute rather than prefixing the .model attribute with the controller name. Due to this behavior, whenever I need do juju.consume, I would need to take the model, separate it at : and use controller and model name separately.
Lastly, the use of -m or -c to set model/controller rather than the environment variables (JUJU_MODEL JUJU_CONTROLLER)
On production bastion hosts, the Juju models and controllers are switched using JUJU_MODEL and JUJU_CONTROLLER environment variables. This would allow the jubilant.temp_model to work in according controllers that were set during the creation. What is the rationale behind explicitly using -m or -c over the environment variables?
Jubilant has been quite helpful, thank you for addressing my concerns!