-
Notifications
You must be signed in to change notification settings - Fork 103
Fix issue with microk8s proxy #1044
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
Conversation
The temporary file used to store the ca_cert was set to delete itself on close. This meant that when it was accessed multiple times it would no longer be present.
cderici
left a comment
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, with one small change needed 👍
|
|
||
| def __del__(self): | ||
| self.close() | ||
| os.unlink(self.temp_ca_file.name) |
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.
Let's handle the FileNotFoundError here ourselves and log a nice warning, instead of __del__ ignoring it and writes it onto the stderr verbatim. (exceptions raised within destructors are suppressed -- to avoid weird behaviors, like the exception handler trying to destroy the object -- thereby calling __del__ again -- see doc)
We really should stop using things like __del__ and turn this into a context by adding __enter__ and __exit__ to handle these things, but that's beyond the scope of this PR.
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.
Makes sense I've got the connection logger and logged the error to that in __del__.
0d4fbe8 to
7002122
Compare
|
/merge |
#1056 ## What's Changed * Make consume respect the controller name in the url by @Aflynn50 in #1038 * Fix multiline description in textarea in bug template GH workflow by @cderici in #1041 * Fix issue with microk8s proxy by @Aflynn50 in #1044 * add missing "revision" parameter to addModel step. by @Thanhphan1147 in #1043 * Add user api to pylibjuju documentation by @cderici in #1049 ## New Contributors * @Thanhphan1147 made their first contribution in #1043 **Full Changelog**: 3.4.0.0...3.5.0.0
…ng-to-existing-model #1265 #### Description #1044 fixed proxy object reuse some time ago I accidentally undid that change in #1186 as I didn't realise that multiple connect/close calls were expected on a given instance. This PR re-applies the change, and cleans up init. (I've rearranged the initialisation order, because `__del__()` is run on a partially-initialised instance if `__init__()` fails half-way through. That's something that happens in unit tests, although unlikely to affect legitimate use.) Fixes: #1264 creating offer fails when connecting to existing model #### QA Steps - No regression in unit or integration tests - Eyeball the code change All CI tests need to pass. Fixes #1264
The temporary file used to store the ca_cert was set to delete itself on close. This meant that when it was accessed multiple times it would no longer be present.
Set to not delete on close and to remove file when the proxy is deleted.
QA Steps
In python
Check all resource in /tmp have been cleaned up
Fixes #1040