canonical / observability-libs

A collection of charm libraries curated by the Observability team.
https://charmhub.io/observability-libs
Apache License 2.0
3 stars 8 forks source link

raise error on duplicate ports passed to patch #73

Open PietroPasotti opened 7 months ago

PietroPasotti commented 7 months ago

Issue

the service patch silently fails if you pass duplicate ports to it, say

                ports=[
                    ServicePort(name="svc1", port=1234, protocol="TCP"),
                    ServicePort(name="svc2", port=1234, protocol="TCP"),
                ],

Solution

catch that and raise an exception as that's user error

Context

this would have saved me a couple of hours of debugging this week