Skip to content

Commit

Permalink
Merge pull request #115 from atc0005/minor-happy-path-fix
Browse files Browse the repository at this point in the history
Minor "happy path" fix
  • Loading branch information
atc0005 authored Nov 18, 2020
2 parents f3a9887 + 63fa2da commit 848d658
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions cmd/check_imap_mailbox/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,25 +178,23 @@ func main() {
}

cfg.Log.Debug().Str("mailbox", folder).Msg("Performing case-sensitive validation")
if textutils.InList(folder, mailboxesList, false) {

// At this point we have confirmed that the requested folder to
// monitor is in the list of folders found on the server
cfg.Log.Debug().Str("mailbox", folder).Bool("found", true).Msg("")
validatedMailboxesList = append(validatedMailboxesList, folder)

} else {

if !textutils.InList(folder, mailboxesList, false) {
cfg.Log.Error().Str("mailbox", folder).Bool("found", false).Msg("")
nagiosExitState.LastError = fmt.Errorf("mailbox not found: %q", folder)
nagiosExitState.ServiceOutput = fmt.Sprintf(
"%s: Mailbox not found",
nagios.StateCRITICALLabel,
)
nagiosExitState.ExitStatusCode = nagios.StateCRITICALExitCode

return
}

// At this point we have confirmed that the requested folder to
// monitor is in the list of folders found on the server
cfg.Log.Debug().Str("mailbox", folder).Bool("found", true).Msg("")
validatedMailboxesList = append(validatedMailboxesList, folder)

}

// At this point we have created a list of validated mailboxes. Process
Expand Down

0 comments on commit 848d658

Please sign in to comment.