-
Notifications
You must be signed in to change notification settings - Fork 119
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
feat(Harness): support user secrets #1176
feat(Harness): support user secrets #1176
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good - a few little nits and a couple of queries.
Other questions/comments:
- The
trigger_secret_expiration
method should probably raise an error if it's used with a user secret. Is that already the case via permissions checking? - Likewise for
trigger_secret_rotation
. - It doesn't seem like we are testing the permission code changes. I think we'd want to have tests that verify that those work as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Tony's comments. I'll review further later. For now, can you please add a PR description with a brief description of the new API and with a usage example?
… raise an error on user secret
Changed For user secret permissions, there are some unit tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me -- thanks. Just a few minor comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we adjust _ensure_secret_owner
so that it explicitly talks about user secrets? It could have a user_secret = secret.owner_name == self.model.uuid
and an and not user_secret
, although that isn't strictly necessary, so maybe just a comment explaining the user secret situation, with the comment that explains unit and app permissions?
I would also feel more comfortable if we had tests that explicitly made sure that user secrets fail ownership checks. This will prevent regressions in the future if we change how the permissions checks are done.
Yes it makes sense. I have added a test to try to do Secret.get_info to validate the ownership. |
Status update: John has started a discussion in the juju development channel, now the preferred names are "application secrets" and "charm secrets", it seems it's not decided yet, I'll wait for a final conclusion before merging this one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Add support for user secrets in Harness. Changes:
Harness.add_user_secret
which simulatesjuju add-secret
.add_model_secret
is deprecated, useadd_charm_secret
. For now,add_model_secret
is an alias toadd_charm_secret
.Use case example:
config.yaml
:charm.py
:test_charm.py
: