Skip to content

Commit

Permalink
do not check cert if not used
Browse files Browse the repository at this point in the history
  • Loading branch information
elfranne committed Feb 6, 2024
1 parent c0653ee commit 207a2d3
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,22 @@ func main() {
}

func checkArgs(event *corev2.Event) (int, error) {
if len(plugin.CertFile) > 0 || len(plugin.KeyFile) > 0 || len(plugin.TrustedCAFile) > 0{
if _, err := os.Stat(plugin.CertFile); errors.Is(err, os.ErrNotExist) {
fmt.Printf("could not load certificate(%s): %v", plugin.CertFile, err)
return sensu.CheckStateCritical, nil
}

if _, err := os.Stat(plugin.CertFile); errors.Is(err, os.ErrNotExist) {
fmt.Printf("could not load certificate(%s): %v", plugin.CertFile, err)
return sensu.CheckStateCritical, nil
}

if _, err := os.Stat(plugin.KeyFile); errors.Is(err, os.ErrNotExist) {
fmt.Printf("could not load certificate key(%s): %v", plugin.KeyFile, err)
return sensu.CheckStateCritical, nil
}
if _, err := os.Stat(plugin.KeyFile); errors.Is(err, os.ErrNotExist) {
fmt.Printf("could not load certificate key(%s): %v", plugin.KeyFile, err)
return sensu.CheckStateCritical, nil
}

if _, err := os.Stat(plugin.TrustedCAFile); errors.Is(err, os.ErrNotExist) {
fmt.Printf("could not load CA(%s): %v", plugin.TrustedCAFile, err)
return sensu.CheckStateCritical, nil
if _, err := os.Stat(plugin.TrustedCAFile); errors.Is(err, os.ErrNotExist) {
fmt.Printf("could not load CA(%s): %v", plugin.TrustedCAFile, err)
return sensu.CheckStateCritical, nil
}
}

return sensu.CheckStateOK, nil
}

Expand Down

0 comments on commit 207a2d3

Please sign in to comment.