-
Notifications
You must be signed in to change notification settings - Fork 16
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
Enhance charm's life cycle. #119
Enhance charm's life cycle. #119
Conversation
Refactoring can be contributed by someone else |
24fc040
to
fd7915d
Compare
fd7915d
to
611ecfc
Compare
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.
Error status definition: any situation entering error status, we can assume there is a bug in charm. In general, if the step fails, it should go to blocked status.
If this is still the logic we want to follow, I think we should enter blocked status in most of case. But I see most of failture cause the charm enter error status now.
linting. Co-authored-by: jneo8 <[email protected]> Continue to remove refactoring code from the previous branch, and fix status handling.
Further removed refactoring code from this PR, and make as less changes as possible. Also cherry-pick @jneo8 strategy checks into this PR. |
Updated description |
Will this MR also cover this one? |
No, the implementation was removed from 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.
nitpick
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.
If there is no further big change, please implement unit test
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.
Command and I don't see where does #114 been fixed?
src/charm.py
Outdated
) | ||
return | ||
|
||
hw_tool_ok, error_msg = self.hw_tool_helper.check_installed() |
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.
Need fix:
Shouldn't we check the resources before checking the service?
Imagine we restart a service with wrong resource.
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.
Just one small comment and the tests would need to be updated to reflect these changes.
Apart from that, LGTM :)
@@ -127,6 +147,10 @@ def name(self) -> HWTool: | |||
"""Name.""" | |||
return self._name | |||
|
|||
@abstractmethod | |||
def check(self) -> bool: |
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.
Would it be possible to rename this to be more descriptive? Maybe check_status
? I'm open to other names as well.
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.
This is coming from this commit, I didn't authored that changes, and it's only internal use, so it's not so important
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.
Ah, never mind then. I still think it could use a nicer name since check
sounds a bit ambiguous but it's alright even if we keep it check
.
Maybe the implementation was removed from this PR, I'll updated the description |
Since we're merging to the |
As I understand, this PR only includes the implementation with ops-testing (with |
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.
Overall LGTM now. Please add more details in test function name & doc-string.
- Fixed some warning message in unittest - Patched exporter retry constants
* Enhance charm's life cycle. (#119) * Enhance charm's life cycle. * Remove unused property. * Cherry-pick from 7513f18, and fix linting. Co-authored-by: jneo8 <[email protected]> Continue to remove refactoring code from the previous branch, and fix status handling. * Move "exporter health check failed and restart" logic into charm.py * add resource check in update_status event, and change Error -> Blocked * Fix typo * Add unittests. * Update unit test docstring and name. * - Used `parameterized` - Fixed some warning message in unittest - Patched exporter retry constants * Separate enabling logic of individual ipmi services monitoring (#123) * Separate enabling logic of individual ipmi services monitoring * Add and refactor unit tests * Fix/resoure install failed (#135) * fix: lifecycle bug fix - Remove install retry - Add cache to hw_white_list to avoid repeat calls - Fix missing resource failed msg in update status hook * fix: Remove resource_failed_msg * fix: Fix type checking comments and defer relation_join hook if checking not pass * fix: Missing return after grafana-agent relation join event defer * fix: Force re-config exporter when upgrade (#140) * refactor: Move restart exporter logic as single function (#139) * Fix/skip remove freeipmi tools (#138) * fix: Skip removing pkg on IPMI strategy Skip removing package because we afraid this cause dependency error for any other services on the same machine. * fix: Skip remove ssacli pkg and repo * test: Fix failed functional test (#141) Fix failure functional test caused because of life-cycle changing. * style: Linter fix (#142) * fix: apt install freeipmi-tools failed on focal (#143) * fix: apt install freeipmi-tools failed on focal Fix: #128 --------- Co-authored-by: Ray Chan <[email protected]> Co-authored-by: Sudeep Bhandari <[email protected]>
Description of changes:
install_or_upgrade
event (addresses 4)Maintenance
status when install or upgradeBlocked
status anddefer
when install or upgrade event failed (both resource and exporter)remove
eventupdate_status
eventError
status. (addresses 2,3)config_changed
eventhw_tool.py
for adding tool validation logicMaybe closes: