bmc-toolbox / bmclib

Library to abstract Baseboard Management Controller interaction
Apache License 2.0
194 stars 37 forks source link

redfish: fix nil check on gofish client #321

Closed joelrebel closed 1 year ago

joelrebel commented 1 year ago

What does this PR implement/change/remove?

fixes a panic on Close() in the Redfish provider if the Redfish client was never setup.

goroutine 37 [running]:
github.com/bmc-toolbox/bmclib/v2/internal/redfishwrapper.(*Client).Close(...)
        /Users/jrebello/go/pkg/mod/github.com/bmc-toolbox/bmclib/v2@v2.0.1-0.20230324092939-d39fb75b6aa9/internal/redfishwrapper/client.go:126
github.com/bmc-toolbox/bmclib/v2/providers/redfish.(*Conn).Close(0x0?, {0x100c00005a804?, 0x477d9e?})
        /Users/jrebello/go/pkg/mod/github.com/bmc-toolbox/bmclib/v2@v2.0.1-0.20230324092939-d39fb75b6aa9/providers/redfish/redfish.go:63 +0x20
github.com/bmc-toolbox/bmclib/v2/bmc.closeConnection({0x107cd78, 0xc000182660}, {0xc0002de280?, 0x2, 0x0?})

Checklist

The HW vendor this change applies to (if applicable)

The HW model number, product name this change applies to (if applicable)

The BMC firmware and/or BIOS versions that this change applies to (if applicable)

What version of tooling - vendor specific or opensource does this change depend on (if applicable)

Description for changelog/release notes

codecov[bot] commented 1 year ago

Codecov Report

Patch and project coverage have no change.

Comparison is base (8e889ca) 43.23% compared to head (c5a726f) 43.23%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #321 +/- ## ======================================= Coverage 43.23% 43.23% ======================================= Files 35 35 Lines 2736 2736 ======================================= Hits 1183 1183 Misses 1430 1430 Partials 123 123 ``` | [Impacted Files](https://codecov.io/gh/bmc-toolbox/bmclib/pull/321?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bmc-toolbox) | Coverage Δ | | |---|---|---| | [internal/redfishwrapper/client.go](https://codecov.io/gh/bmc-toolbox/bmclib/pull/321?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bmc-toolbox#diff-aW50ZXJuYWwvcmVkZmlzaHdyYXBwZXIvY2xpZW50Lmdv) | `20.00% <0.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

joelrebel commented 1 year ago

rebased on main