canonical / pebble

Pebble is a lightweight Linux service manager with layered configuration and an HTTP API.
https://canonical-pebble.readthedocs-hosted.com/
GNU General Public License v3.0
146 stars 54 forks source link

fix(state): set `noticeCond` correctly in `ReadState` #320

Closed olivercalder closed 12 months ago

olivercalder commented 12 months ago

With the addition of support for notices in the pebble state, there was a small bug introduced in ReadState, which was not updated to set the new noticeCond. As a result, a call to WaitNotices from a state which was created via ReadState will cause a null pointer exception.

This PR adds the proper noticeCond initialization in ReadState, as well as a unit test to check that WaitNotices does not panic on a state which was created via ReadState.

benhoyt commented 12 months ago

Trivial fix, merged without further review. I just applied the code review nits directly, as I needed this change for something I'm working on too. Thanks @olivercalder!