Conversation
This introduces two changes:
(1) If there are many matches, we delete all matching secrets.
Due to a previous issue, we may have many ...
(2) We extract the UUID from the id string and pass it to
delete_secret(). This is a workaround to something that looks
like a bug in the SDK to me.
Signed-off-by: Kurt Garloff <kurt@garloff.de>
Let's comment on the SDK issue here. If it should change to return a UUID in the id attribute, we would now still work, so we are robust against a possible direction that a fix might take. Signed-off-by: Kurt Garloff <kurt@garloff.de>
Signed-off-by: Kurt Garloff <kurt@garloff.de>
gtema
approved these changes
Apr 3, 2025
Contributor
gtema
left a comment
There was a problem hiding this comment.
Right, I knew this is very awkward on the barbican side (not supporting I'd as such), but also on SDK side I never worked with the service
Improve comment explaining the SDK (and possibly API) misbehavior. Also add comment on chosen workaround with robustness in mind, but without taking it to the extreme of adding 5 additional API calls. Signed-off-by: Kurt Garloff <kurt@garloff.de>
This keeps the code cleaner. Signed-off-by: Kurt Garloff <kurt@garloff.de>
mbuechse
reviewed
Apr 4, 2025
| each time checking whether it was effective. But that's three delete | ||
| plus list calls and very ugly.) | ||
| """ | ||
| uuid_part = secret.id.rfind('/') + 1 |
Contributor
There was a problem hiding this comment.
https://docs.python.org/3/library/stdtypes.html#str.rsplit
I think the case distinction can be dropped by using rsplit with maxsplit=1
uuid = secret.id.rsplit('/', 1)[0]Should work in both cases
Member
Author
There was a problem hiding this comment.
Except that it should be secret.id.split('/')[-1].
Member
Author
There was a problem hiding this comment.
... which is the same as secret.id.rsplit('/',1)[-1], except that the latter might be slightly cheaper as it creates a list with max 2 elements.
Contributor
There was a problem hiding this comment.
yeah, you're right, I wrote this in a hurry 🙈
... based on suggestion by @mbuechse. Signed-off-by: Kurt Garloff <kurt@garloff.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #896