-
Notifications
You must be signed in to change notification settings - Fork 20
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
[MISC] Merge update_tls_flag into update_endpoints #669
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #669 +/- ##
==========================================
+ Coverage 71.31% 71.40% +0.08%
==========================================
Files 13 13
Lines 3193 3189 -4
Branches 476 475 -1
==========================================
Hits 2277 2277
+ Misses 800 797 -3
+ Partials 116 115 -1 ☔ View full report in Codecov by Sentry. |
# Set TLS flag | ||
self.database_provides.set_tls( | ||
event.relation.id, | ||
"True" if self.charm.is_tls_enabled else "False", | ||
) | ||
|
||
# Set TLS CA | ||
if self.charm.is_tls_enabled: | ||
_, ca, _ = self.charm.tls.get_tls_files() | ||
self.database_provides.set_tls_ca(event.relation.id, ca) | ||
|
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.
Endpoints will be updated anyway
if not self._peers: | ||
return set() |
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.
Seen fail on ci:
File "/var/lib/juju/agents/unit-postgresql-gcp-1/charm/./src/charm.py", line 825, in members_ips
return set(json.loads(self._peers.data[self.app].get("members_ips", "[]")))
AttributeError: 'NoneType' object has no attribute 'data'
Early setting of the tls flags can cause errors when setting too early. E.g.
This PR merges update_tls_flag into update_endpoints to reuse the checks for
PrematureDataAccessError