-
Notifications
You must be signed in to change notification settings - Fork 102
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
Fix issue with microk8s proxy #1044
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.
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 👍
@@ -60,6 +60,7 @@ def connect(self): | |||
|
|||
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
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