Comment 4 for bug 1915512

Revision history for this message
Felipe Reyes (freyes) wrote : Re: [Bug 1915512] Re: Health manager port not deleted on unit removal

On Fri, 2021-04-23 at 10:24 +0000, Hua Zhang wrote:
> Hi, I found juju has no pre hook to clean up hm port resources before
> removing unit, so I proposed another way to do it, pls see my above
> patch for the details. Does anyone have any better suggestions?
> Meanwhile I will also continue to complete the test code and self-
> test
> next. thanks.

Since juju-2.8.0 there is JUJU_DEPARTING_UNIT environment variable to
figure out what unit is being removed, so when `local_unit() ==
departing_unit()` is where the clean up should happen. The fix could
take advantage of this and provide a action (maybe?) that operators
running juju<2.8.0 would need to use to clean up ports.