Skip to content

Unable to retrieve secret value #947

@gruyaume

Description

@gruyaume

Description

I am unable to retrieve the Juju secret content. I'm not certain whether this is a real bug or whether "I'm holding it wrong". In any case I haven't found how this can be done by looking at the documentation.

Whenever I try to retrieve the juju secret value, I receive "None" even though I know the secret exists and has some content (via the CLI).

Urgency

Blocker for our release

Python-libjuju version

3.2.2

Juju version

3.1.5

Reproduce / Test

Here's how I am using the lib:

from juju import jasyncio
from juju.model import Model


async def main():

    m = Model()
    await m.connect()

    secrets = await m.list_secrets(show_secrets=True)

    first_secret = secrets.results[0]
    print(first_secret.value)
    await m.disconnect()


if __name__ == '__main__':
    jasyncio.run(main())

And the results I'm getting:

None

On the other hand, I am able to get the secret via the Juju CLI

(venv) guillaume@thinkpad:~/code/vault-k8s-operator$ juju secrets
ID                    Owner      Rotation  Revision  Last updated
cjt5s4lp3des77vsgehg  vault-k8s  never            1  36 minutes ago 
(venv) guillaume@thinkpad:~/code/vault-k8s-operator$ juju show-secret cjt5s4lp3des77vsgehg --reveal
cjt5s4lp3des77vsgehg:
  revision: 1
  owner: vault-k8s
  created: 2023-09-07T23:34:42Z
  updated: 2023-09-07T23:34:42Z
  content:
    roottoken: hvs.p9v8yPn1iM0tE3w20vRyVmED
    unsealkeys: '["8adf4e322076da1de3a1b955f1a2edd0edd726ed171424b6c82cf769d9e709e0"]'

Metadata

Metadata

Labels

kind/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