ack-sel command is formatted incorrectly

Bug #1933883 reported by Connor Chamberlain
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
hw-health-charm
Fix Released
Undecided
Unassigned

Bug Description

The ack-sel action has a formatting error that causes it to quietly fail.

When using the action, a typical output looks like:
```
$ juju run-action hw-health/669 ack-sel --wait
unit-hw-health-669:
  UnitId: hw-health/669
  id: "141747"
  results:
    message: Only SEL entries newer than 2021-06-28 will be considered
  status: completed
  timing:
    completed: 2021-06-28 21:38:17 +0000 UTC
    enqueued: 2021-06-28 21:38:17 +0000 UTC
    started: 2021-06-28 21:38:17 +0000 UTC
```

Which seems to indicate success. However, Thruk catches that this action exits with code 1:
```
UNKNOWN: invalid sensor type '--date-range=06/28/2021-now'

-> Execution of /usr/sbin/ipmi-sel failed with return code 1.
-> /usr/sbin/ipmi-sel was executed with the following parameters:
sudo /usr/sbin/ipmi-sel --output-event-state --interpret-oem-data --entity-sensor-names --sensor-types=all --exclude-sensor-types=battery,entity_presence,module_board --exclude-sensor-types=Management_Subsystem_Health --date-range=06/28/2021-now
```

Manually running the above command works. Looking at it, the formatting is correct and there is no reason for --date-range to be mistaken as part of --exclude-sensor-types.

However, when looking at /etc/cron.d/hwhealth_ipmi, I find an error:
```
/etc/cron.d$ cat hwhealth_ipmi
3,8,13,18,23,28,33,38,43,48,53,58 * * * * nagios /usr/local/lib/nagios/plugins/cron_ipmi_sensors.py -xT battery,entity_presence,module_board -xST battery,entity_presence,module_board --seloptions --exclude-sensor-types=Management_Subsystem_Health,--date-range=06/28/2021-now --sexclude /var/lib/nagios/ipmi_exclude
```

Here we can see that a space between --exclude-sensor-types and --date-range is been replaced with a comma. If I manually correct this file then run the action again, the formatting mistake is restored.

I've replicated this behavior on a second hw-health unit running on a different host.

Related branches

Revision history for this message
Xav Paice (xavpaice) wrote :

add_date_range_to_cron_args() in class Ipmi (tools.py) seems to join the args with "," rather than spaces.

Would be good to reproduce the error with a unit test, then fix it. Seems that the actual cron text is different to the list of args.

Revision history for this message
Edin S (exsdev) wrote :

This appears to be a parsing issue: https://github.com/thomas-krenn/check_ipmi_sensor_v3/issues/31

As per the above bug report a fix was merged: https://github.com/thomas-krenn/check_ipmi_sensor_v3/pull/46

The fix has made its way into the master branch as of https://code.launchpad.net/~xavpaice/charm-hw-health/+git/hw-health-charm/+merge/404361

I've just pushed an updated hw-health build to ~llama-charmers-next/hw-health (revision 21)

Changed in charm-hw-health:
status: New → Fix Committed
Celia Wang (ziyiwang)
Changed in charm-hw-health:
status: Fix Committed → Fix Released
milestone: none → 21.07
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.