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
Simplify KRA transport cert cache #616
Conversation
|
Needs to be merged into ipa-4.5 branch, too. |
|
NACK on the completely unnecessary changes in |
|
Please open a ticket and put it into commit messsage |
ipaclient/plugins/vault.py
Outdated
| # cache it again | ||
| _transport_cert_cache.store_cert( | ||
| self.api.env.domain, transport_cert | ||
| ) |
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.
Calling vaultconfig_show already writes the cert to the file. There is no reason to do it again here.
|
@HonzaCholasta I don't agree with you. Mutable mapping is too complex for a simple cache. My approach is KISS. |
In-memory cache causes problem in forking servers. A file based cache is good enough. It's easier to understand and avoids performance regression and synchronization issues when cert becomes out-of-date. Signed-off-by: Christian Heimes <cheimes@redhat.com>
I don't think this needs to be discussed further, either do the requested changes or this PR won't be merged. |
| os.rename(f.name, filename) | ||
| except Exception: | ||
| os.unlink(f.name) | ||
| raise |
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.
The commit message is missing any information about this change.
|
Size of a patch is a wrong metric. It's about code complexity. My patch reduces code complexity and logic complexity. It also fixes at least two bugs: multi-process concurrency bug and logging bug that prevents the code from working correctly. |
| transport_cert = self._transport_certs[domain] | ||
| except KeyError: | ||
| transport_cert = None | ||
| def load_cert(self, domain): |
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 rename this to get? The _cert suffix seems superfluous, given the class is named _Transport*Cert*Cache.
|
|
||
| return transport_cert | ||
| def store_cert(self, domain, transport_cert): |
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 rename this to put?
|
|
||
| self._transport_certs[domain] = transport_cert | ||
| def remove_cert(self, domain): |
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 rename this to remove or delete?
|
@tiran, you are right about the interface change, I was seeing things that are not there, I'm sorry. Please address inline comments (mainly the one about missing info in commit message, others are mostly nitpicks) and it's an ACK. |
|
I guess you must have missed my last comment about the PR being almost OK - reopening. |
|
I did not miss #616 (comment) |
In-memory cache causes problem in forking servers. A file based cache is
good enough. It's easier to understand and avoids performance regression
and synchronization issues when cert becomes out-of-date.
https://pagure.io/freeipa/issue/6787
Signed-off-by: Christian Heimes cheimes@redhat.com