From 0cd3fc852524c5cb4a058fc14c7610ad2c4a9121 Mon Sep 17 00:00:00 2001 From: Alik Khilazhev Date: Wed, 30 Nov 2022 17:29:53 +0700 Subject: [PATCH] fix: issue resolution Signed-off-by: Alik Khilazhev --- pkg/notify/notify.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/notify/notify.go b/pkg/notify/notify.go index 22aa294..65fe93b 100644 --- a/pkg/notify/notify.go +++ b/pkg/notify/notify.go @@ -128,8 +128,12 @@ func (r *Receiver) Notify(data *alertmanager.Data, hashJiraLabel bool) (bool, er return false, nil } - level.Info(r.logger).Log("msg", "issue was recently resolved, reopening", "key", issue.Key, "label", issueGroupLabel) - return r.reopen(issue.Key) + if r.conf.ReopenEnabled != nil && !*r.conf.ReopenEnabled { + level.Debug(r.logger).Log("msg", "reopening disabled, skipping search for existing issue") + } else { + level.Info(r.logger).Log("msg", "issue was recently resolved, reopening", "key", issue.Key, "label", issueGroupLabel) + return r.reopen(issue.Key) + } } if len(data.Alerts.Firing()) == 0 { @@ -301,11 +305,6 @@ func (r *Receiver) search(project, issueLabel string) (*jira.Issue, bool, error) func (r *Receiver) findIssueToReuse(project string, issueGroupLabel string) (*jira.Issue, bool, error) { - if r.conf.ReopenEnabled != nil && !*r.conf.ReopenEnabled { - level.Debug(r.logger).Log("msg", "reopening disabled, skipping search for existing issue") - return nil, false, nil - } - issue, retry, err := r.search(project, issueGroupLabel) if err != nil { return nil, retry, err