cron_ssacli mishandling parsing errors
Bug #1907463 reported by
Adam Dyess
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
hw-health-charm |
Fix Released
|
Medium
|
Adam Dyess |
Bug Description
in main()
```
errors = []
for slot in slots:
errors += check_controlle
errors += check_array(slot)
if len(errors) > 0:
msg = "CRIT {} error(s): {}".format(
exit = 2
else:
msg = "OK No errors found"
exit = 0
```
both check_controller and check_array methods return strings or sometimes None. Using list += with strings creates an array of characters. I don't think this was the intent
This may have been intended:
```
errors = []
for slot in slots:
errors = "".join(
```
Related branches
charm-hw-health:bug/1907463
- Andrea Ieri: Approve
-
Diff: 64 lines (+15/-4)2 files modifiedsrc/files/common/hw_health_lib.py (+10/-1)
src/files/ssacli/cron_ssacli.py (+5/-3)
Changed in charm-hw-health: | |
status: | Fix Committed → Fix Released |
milestone: | 21.02 → 21.01 |
To post a comment you must log in.
No, consulting the actual CRIT formatter, a better resolution is
```
errors. append( check_controlle r(slot) )
errors. append( check_array( slot))
errors = []
for slot in slots:
errors = [_ for _ in errors if _]
```