Module: check_mk
Branch: master
Commit: a8c601d19ec7725e63ae0978fa546d712b2b8de0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a8c601d19ec772…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Dec 4 12:34:43 2015 +0100
#2807 FIX check_mail_loop: POP3 protocol wasn't working at all
---
.werks/2807 | 8 ++++++++
ChangeLog | 1 +
doc/treasures/active_checks/check_mail_loop | 9 ++++-----
3 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/.werks/2807 b/.werks/2807
new file mode 100644
index 0000000..a6a177b
--- /dev/null
+++ b/.werks/2807
@@ -0,0 +1,8 @@
+Title: check_mail_loop: POP3 protocol wasn't working at all
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1449228796
+Class: fix
+
diff --git a/ChangeLog b/ChangeLog
index 2a2e670..b700825 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -138,6 +138,7 @@
* 1309 FIX: multipath: Fixed name handling of multipaths...
NOTE: Please refer to the migration notes!
* 1310 FIX: blade_bx_powerfan: Check now uses better default leves...
+ * 2807 FIX: check_mail_loop: POP3 protocol wasn't working at all
Multisite:
* 2684 Added icons for downloading agent data / walks of hosts...
diff --git a/doc/treasures/active_checks/check_mail_loop
b/doc/treasures/active_checks/check_mail_loop
index c9702ee..2f677de 100755
--- a/doc/treasures/active_checks/check_mail_loop
+++ b/doc/treasures/active_checks/check_mail_loop
@@ -239,7 +239,7 @@ def fetch_mails():
for i in range(num_messages):
index = i+1
lines = g_M.retr(index)[1]
- mails[i] = email.message_from_string("".join(lines))
+ mails[i] = email.message_from_string("\n".join(lines))
else:
# Get mails from IMAP mailbox
@@ -257,7 +257,7 @@ def fetch_mails():
raise Exception('Failed to fetch mail %s (%s). Available
messages: %r' % (num, parse_exception(e), messages))
# Now filter out the messages for this check
- pattern = re.compile('(?:Re: )?Check_MK-Mail-Loop ([^\s]+) ([^\s]+)')
+ pattern = re.compile('(?:Re: |WG: )?Check_MK-Mail-Loop ([^\s]+)
([^\s]+)')
for index, msg in mails.items():
matches = pattern.match(msg.get('Subject', ''))
if matches:
@@ -372,9 +372,8 @@ def cleanup_mailbox():
# processed before! In the meantime there might be occured new ones.
for ident, (mail_index, recv_ts) in g_mails.items():
if fetch_proto == 'POP3':
- response = g_M.dele(ident)
- response = None
- if response != "+OK":
+ response = g_M.dele(mail_index + 1)
+ if not response.startswith("+OK"):
raise Exception("Response from server: [%s]" % response)
else:
ty, data = g_M.store(mail_index, '+FLAGS', '\\Deleted')