Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to retrieve secret value #947

Open
gruyaume opened this issue Sep 8, 2023 · 11 comments · Fixed by #1065
Open

Unable to retrieve secret value #947

gruyaume opened this issue Sep 8, 2023 · 11 comments · Fixed by #1065
Assignees
Labels
kind/bug indicates a bug in the project

Comments

@gruyaume
Copy link

gruyaume commented Sep 8, 2023

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"]'
@gruyaume gruyaume added the kind/bug indicates a bug in the project label Sep 8, 2023
@cderici cderici added the 3.2 label Sep 21, 2023
@github-actions
Copy link

This issue is marked as incomplete because it has been open 30 days with no activity. Please remove incomplete label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the state/incomplete need more information label Oct 22, 2023
@gruyaume
Copy link
Author

@cderici This issue was automatically marked as incomplete. Is there any effort placed on implementing what is required here?

@github-actions github-actions bot removed the state/incomplete need more information label Oct 24, 2023
@cderici
Copy link
Contributor

cderici commented Oct 24, 2023

@cderici This issue was automatically marked as incomplete. Is there any effort placed on implementing what is required here?

Sorry for the late response, Guillaume, I do have an active ticket for this, I'll take a look very soon. Though keep in mind, the support for the secrets are pretty rudimentary at this point (on libjuju), only some basic stuff that Juan implemented to enable people to use it a little bit. We'll have a proper roadmap item to bring full support of secrets in the next cycle to both pylibjuju and the terraform provider.

Copy link

This issue is marked as incomplete because it has been open 30 days with no activity. Please remove incomplete label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the state/incomplete need more information label Nov 24, 2023
Copy link

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 29, 2023
@cderici cderici reopened this Nov 29, 2023
@cderici cderici added work-in-progress and removed state/incomplete need more information labels Nov 29, 2023
@gboutry
Copy link
Contributor

gboutry commented Jun 27, 2024

@cderici is there any news on this issue?

Unblocked myself by using the facade directly:

await f.ListSecrets(filter_={"uri": pk_id}, show_secrets=True)

@cderici cderici removed the 3.2 label Jul 11, 2024
jujubot added a commit that referenced this issue Jul 11, 2024
#1065

#### Description

ListSecrets facade takes 2 arguments: `filter_`, and `show_secrets`. Previous instanciation passed a dict, which then landed in `filter_` field.

Fixes: #947


#### QA Steps

*<Commands / tests / steps to run to verify that the change works:>*

await f.ListSecrets(filter_={"uri": <secret_id>}, show_secrets=True)

All CI tests need to pass.

*<Please note that most likely an additional test will be required by the reviewers for any change that's not a one liner to land.>*

#### Notes & Discussion

*<Additional notes for the reviewers if needed. Please delete section if not applicable.>*
@arturo-seijas
Copy link
Contributor

@cderici we are also affected by this issue. Is there any way we can track progress?

@benhoyt
Copy link
Collaborator

benhoyt commented Dec 19, 2024

We recommend using @gboutry's (fairly simple) workaround of using facade.ListSecrets directly. Apart from making python-libjuju work with Juju 4 (the "all-watcher removal" work that @dimaqq is doing), we're not going to be making many more updates to python-libjuju.

Instead, for new charm integration tests moving forward, we're focussing our efforts on https://github.com/canonical/jubilant -- which is far too alpha to use right now, but just letting you know the direction. Our intention with that is to have an alpha version to try by the end of Jan, and a v1 to use by the end of the 25.04 cycle.

@gboutry
Copy link
Contributor

gboutry commented Dec 19, 2024

This is supposed to be fixed since 3.5.2.0: #1071

@benhoyt
Copy link
Collaborator

benhoyt commented Dec 19, 2024

Okay, I hadn't read carefully and presumed it would require a new feature. I'll reopen, and we can look into this after the Christmas break -- if it's a straight-forward bug in python-libjuju we'll try to fix it, if it requires new wiring or a new feature, we'll probably skip. Note that Charm Tech agreed to take over maintenance of python-libjuju from the Juju team as they didn't have time with the Juju Mongo-to-dqlite transition, but Charm Tech also has our own roadmap items. :-)

For reference: model.list_secrets actually just calls ListSecrets pretty directly, passing the filter and show_secrets value through, so maybe the workaround is actually to provide the URI filter rather than using the facade directly.

@benhoyt
Copy link
Collaborator

benhoyt commented Dec 19, 2024

@james-garner-canonical Assigning to you to look at after the break. Let's determine the cause of this, and if it's a straight-forward bug fix we should go ahead and fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug indicates a bug in the project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants