Skip to content

Commit

Permalink
Moved nagios mode to move to new email message. Refs #5.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterfpeterson committed Sep 2, 2011
1 parent 62fa0eb commit 31084be
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions CodeNotifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,10 @@ def __getTicket(self, url):
# give up
return None

class NagiosMsg(EmailMsg):
class NagiosMsg(StatusMsg):
def __init__(self, config, email_msg, **kwargs):
EmailMsg.__init__(self, config, email_msg, **kwargs)
StatusMsg.__init__(self, config, **kwargs)
self.__email = EmailMsg(email_msg)
self.__initSubject()
self.__initBody()
status = [self.__subject__]
Expand All @@ -231,7 +232,7 @@ def __init__(self, config, email_msg, **kwargs):
self.setMsg(" - ".join(status))

def __initSubject(self):
subject = self.getSubject().strip()
subject = self.__email.subject
subject = re.sub(r'\s*\*+\s*', '', subject)
subject = re.sub(r'\s+alert\s+-', ':', subject)
subject = re.sub('/', ' ', subject)
Expand All @@ -247,7 +248,7 @@ def __sanitize(self, text):
return text.strip()

def __initBody(self):
body = self.getEmailBody()
body = self.__email.body

# get all of the keys
self.__note_type__ = getProperty(body, r'^Notification Type:\s+(\w+)$')
Expand Down Expand Up @@ -290,7 +291,7 @@ def setHost(self, host = ""):
self.__host = host

def __parseSubject(self):
subject = self.getSubject().strip()
subject = self.subject
if len(subject.strip()) <= 0:
return ""

Expand Down

0 comments on commit 31084be

Please sign in to comment.