canonical / mysql-operator

Machine charm for MySQL following the operator framework
https://charmhub.io/mysql
Apache License 2.0
7 stars 11 forks source link

fix: when removing a secret, remove it from the cache, too #383

Closed tonyandrewmeyer closed 9 months ago

tonyandrewmeyer commented 9 months ago

Issue

When a secret is completely emptied of content, the lib removes all revisions from Juju, but leaves the cached object in place. This means that code can still access it, when in practice it has actually gone.

Solution

Remove the secret from the SecretCache when it's removed from Juju with remove_all_revisions(). This does access a private attribute, but the comment just above this says that this code is temporary until the removal is in the lib itself, where the private attribute access would be fine.

codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (19c37be) 65.92% compared to head (dabd469) 65.79%. Report is 8 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #383 +/- ## ========================================== - Coverage 65.92% 65.79% -0.14% ========================================== Files 17 17 Lines 3120 3131 +11 Branches 410 412 +2 ========================================== + Hits 2057 2060 +3 - Misses 935 943 +8 Partials 128 128 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

tonyandrewmeyer commented 9 months ago

I'm not sure on the protocols here, sorry - am I meant to do an update of the libraries even though that's not required here? Happy to do so if that's the case.

tonyandrewmeyer commented 9 months ago

It seems like this code has moved into data-platform-libs so this is now out-of-date.