Skip to content

Model.consume() from a different controller doesn't work #1031

@sudeephb

Description

@sudeephb

Calling model.consume as shown below causes an error.

await model.consume(
               f"admin/{k8s_model.name}.grafana-dashboards",
               application_alias="grafana",
               controller_name=k8s_ctl.controller_name,
        )

The error looks like this:

FAILED ... - juju.errors.JujuError: ['application offer "admin/current-model.grafana-dashboards" not found'] 

where, current-model is the model name, and grafana-dashboards offer is exposed.

As a workaround, using juju CLI works ie. the following works fine

        cmd = [
            "juju",
            "consume",
            "--model",
            f"current-controller:current-model",
            f"{k8s_ctl.controller_name}:admin/{k8s_model.name}.grafana-dashboards",
        ]
        subprocess.run(cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

The name of the model is the same in both controllers.
python-libjuju version is 3.3.1.1

Metadata

Metadata

Assignees

Labels

hint/3.xgoing on main branchhint/good-first-issuea small bug good for newcomerskind/bugindicates a bug in the project

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions