-
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] Define charm utility properties #842
base: main
Are you sure you want to change the base?
Conversation
09dc015
to
99586b8
Compare
99586b8
to
b339193
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #842 +/- ##
==========================================
+ Coverage 75.53% 75.63% +0.09%
==========================================
Files 12 12
Lines 3115 3127 +12
Branches 466 466
==========================================
+ Hits 2353 2365 +12
Misses 621 621
Partials 141 141 ☔ View full report in Codecov by Sentry. |
if not (self.charm.is_unit_stopped or self._is_following_promoted_cluster()) or not all( | ||
"stopped" in self.charm._peers.data[unit] | ||
or self.charm._peers.data[unit].get("unit-promoted-cluster-counter") | ||
== self._get_highest_promoted_cluster_counter_value() | ||
for unit in {*self.charm._peers.units, self.charm.unit} | ||
for unit in self.charm._peers.units |
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.
Review these lines carefully. I think I preserved the original logic
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.
I think so too.
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, thanks!
This PR defines a set of charm properties to reduce the chance of introducing typos when checking for specific keys in the app / unit data-bags, as well as reduce the cognitive load of logical statements.
The new properties are:
is_cluster_restoring_backup
.is_cluster_restoring_to_time
.is_unit_departing
is_unit_stopped
.The existing properties, now used throughout the codebase are:
is_cluster_initialised
.