Merge ~canonical-is-bootstack/charm-hw-health:bug/1904045 into charm-hw-health:master

Proposed by Alvaro Uria
Status: Merged
Approved by: James Troup
Approved revision: ee9ba7633589688cb16d88010decacbd49a63ff7
Merged at revision: 278e94a27a23f46a4964562962f904728dc0fd46
Proposed branch: ~canonical-is-bootstack/charm-hw-health:bug/1904045
Merge into: charm-hw-health:master
Diff against target: 29 lines (+5/-2)
2 files modified
src/lib/hwhealth/hwdiscovery.py (+4/-1)
src/lib/hwhealth/tools.py (+1/-1)
Reviewer Review Type Date Requested Status
BootStack Reviewers Pending
Review via email: mp+393712@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alvaro Uria (aluria) wrote :

* lint: commands succeeded
* unit tests: 42 passed, 16 warnings in 1.11s
* func tests: 27 passed, 17733 warnings in 1363.28s (0:22:43)

Revision history for this message
Alvaro Uria (aluria) wrote :

BTW, I tested the corner case of upgrading cs:hw-health-5 to a build of this fix, and the /var/lib/nagios/ipmi_sensors.out file got automatically generated with nagios:nagios ownership. The cronjob was reconfigured to run as "nagios" and the croned script was able to replace the root-owned generated file from before.

Revision history for this message
James Troup (elmo) wrote :

LGTM

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/lib/hwhealth/hwdiscovery.py b/src/lib/hwhealth/hwdiscovery.py
2index 282f499..1bb8dba 100644
3--- a/src/lib/hwhealth/hwdiscovery.py
4+++ b/src/lib/hwhealth/hwdiscovery.py
5@@ -30,7 +30,10 @@ def get_tools(manufacturer="auto"):
6 # Some system vendors have multiple tools, have to iterate sets
7 system_tools = set(chain.from_iterable(SUPPORTED_SYSTEMS.values()))
8 driver_tools = set(SUPPORTED_DRIVERS.values())
9- all_tools = storage_tools | system_tools | driver_tools
10+ ipmi_tools = set()
11+ if hookenv.config("enable_ipmi"):
12+ ipmi_tools = {tools.Ipmi}
13+ all_tools = storage_tools | system_tools | driver_tools | ipmi_tools
14 series_filtered_tools = set(
15 tool for tool in all_tools if tool.is_series_supported()
16 )
17diff --git a/src/lib/hwhealth/tools.py b/src/lib/hwhealth/tools.py
18index ddb602f..08c96dd 100644
19--- a/src/lib/hwhealth/tools.py
20+++ b/src/lib/hwhealth/tools.py
21@@ -628,7 +628,7 @@ class Ipmi(Tool):
22 def configure_nrpe_check(self, nrpe_setup):
23 # extra options for check_ipmi_sensors Perl script are configured in
24 # the cronjob
25- self._install_cronjob()
26+ self._install_cronjob(cron_user="nagios")
27 super().configure_nrpe_check(nrpe_setup)
28
29 def install(self):

Subscribers

People subscribed via source and target branches

to all changes: