cron_ssacli mishandling parsing errors

Bug #1907463 reported by Adam Dyess
6
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_controller(slot)
        errors += check_array(slot)

    if len(errors) > 0:
        msg = "CRIT {} error(s): {}".format(len(errors), " - ".join(errors))
        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.append(check_controller(slot))
        errors.append(check_array(slot))
    errors = "".join(filter(None, errors))
```

Related branches

Revision history for this message
Adam Dyess (addyess) wrote :

No, consulting the actual CRIT formatter, a better resolution is

```
    errors = []
    for slot in slots:
        errors.append(check_controller(slot))
        errors.append(check_array(slot))
    errors = [_ for _ in errors if _]
```

Revision history for this message
Adam Dyess (addyess) wrote :

Resolved in cs:~llama-charmers-next/hw-health-16

Changed in charm-hw-health:
status: New → Fix Committed
importance: Undecided → Medium
assignee: nobody → Adam Dyess (addyess)
milestone: none → 21.02
Linda Guo (lihuiguo)
Changed in charm-hw-health:
status: Fix Committed → Fix Released
milestone: 21.02 → 21.01
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.