icinga

Icinga2 API client in Go
git clone https://git.olowe.co/icinga
Log | Files | Refs | README | LICENSE

commit bd9616a8e48b8a2f05021f71883d555b874c97e4
parent 2f7e40d9e97ce934b511c4468f323f9fbaa27f29
Author: Oliver Lowe <o@olowe.co>
Date:   Thu, 27 Apr 2023 13:19:53 +1000

Always return a usable Client

Just because we have an error connecting to the server doesn't mean
the client's configuration is invalid. Callers can inspect the error
we return and decide what to do with the returned client.

Diffstat:
Micinga.go | 6++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/icinga.go b/icinga.go @@ -77,10 +77,8 @@ var ErrNoMatch = errors.New("no object matches filter") // skips TLS certificate verification. func Dial(addr, username, password string, client *http.Client) (*Client, error) { c := &Client{addr, username, password, client} - if _, err := Permissions(c); err != nil { - return nil, err - } - return c, nil + _, err := Permissions(c) + return c, err } // Permissions returns the permissions granted to the Client.