Skip to content

JujuAPIError: permission denied from juju FullStatus API call #1092

@yanksyoon

Description

@yanksyoon

Description

This is a follow-up ticket report from https://matrix.to/#/!xzmWHtGpPfVCXKivIh:ubuntu.com/$5-Tq8RLBv0TZI4z-49_0HdGMU0th_O417NNJXBiAVuY?via=ubuntu.com&via=matrix.org&via=matrix.debian.social.

I've got an integration test that is able to deploy application, integration applications and all but as soon as I try to wait for the application, Juju will throw a juju.errors.JujuAPIError: permission denied. The applications are Active and working fine.
For context, this is using a private-endpoint connection method to connect to the model (see https://github.com/canonical/github-runner-operator/blob/713efe6f59e7c0bfeb97bce7f42860692d6ff5bc/tests/integration/setup_private_endpoint_model.sh).

Full integration test error log/stacktrace: https://pastebin.canonical.com/p/3RCbKwB4kQ/

2024-08-25T10:47:58.8648346Z   File "/home/ubuntu/actions-runner/_work/github-runner-operator/github-runner-operator/.tox/integration-juju3.2/lib/python3.10/site-packages/juju/model.py", line 2736, in wait_for_idle
2024-08-25T10:47:58.8650200Z     app_status = await app.get_status()
2024-08-25T10:47:58.8652154Z   File "/home/ubuntu/actions-runner/_work/github-runner-operator/github-runner-operator/.tox/integration-juju3.2/lib/python3.10/site-packages/juju/application.py", line 476, in get_status
2024-08-25T10:47:58.8654158Z     full_status = await client_facade.FullStatus(patterns=None)
2024-08-25T10:47:58.8656398Z   File "/home/ubuntu/actions-runner/_work/github-runner-operator/github-runner-operator/.tox/integration-juju3.2/lib/python3.10/site-packages/juju/client/facade.py", line 486, in wrapper
2024-08-25T10:47:58.8658123Z     reply = await f(*args, **kwargs)
2024-08-25T10:47:58.8660114Z   File "/home/ubuntu/actions-runner/_work/github-runner-operator/github-runner-operator/.tox/integration-juju3.2/lib/python3.10/site-packages/juju/client/_client6.py", line 1340, in FullStatus
2024-08-25T10:47:58.8661868Z     reply = await self.rpc(msg)
2024-08-25T10:47:58.8663783Z   File "/home/ubuntu/actions-runner/_work/github-runner-operator/github-runner-operator/.tox/integration-juju3.2/lib/python3.10/site-packages/juju/client/facade.py", line 659, in rpc
2024-08-25T10:47:58.8665625Z     result = await self.connection.rpc(msg, encoder=TypeEncoder)
2024-08-25T10:47:58.8668106Z   File "/home/ubuntu/actions-runner/_work/github-runner-operator/github-runner-operator/.tox/integration-juju3.2/lib/python3.10/site-packages/juju/client/connection.py", line 677, in rpc
2024-08-25T10:47:58.8669950Z     raise errors.JujuAPIError(result)
2024-08-25T10:47:58.8670641Z juju.errors.JujuAPIError: permission denied

Urgency

Annoying bug in our test suite

Python-libjuju version

3.2.3.0

Juju version

3.5.3

Reproduce / Test

1. Setup appropriate credentials for juju controller, model and account in `/.local/share/juju` dir.
2. Using Juju.Model, connect to the model.

from juju.model import Model
import pytest_asyncio

@pytest_asyncio.fixture(name="model")
async def model_fixture():
    model = Model()
    await model.connect()
    yield model
    await model.disconnect()

async def test_connection(model:Model):
    app = await model.deploy("ubuntu")
    await model.wait_for_idle(apps=[app.name])
    # should raise an error here

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions