mirror of
https://github.com/chatmail/relay.git
synced 2026-05-19 12:28:06 +00:00
fix capturing of logging to capture postfix better
This commit is contained in:
@@ -61,7 +61,8 @@ def imap(maildomain):
|
|||||||
|
|
||||||
class ImapConn:
|
class ImapConn:
|
||||||
AuthError = imaplib.IMAP4.error
|
AuthError = imaplib.IMAP4.error
|
||||||
logunit = "dovecot"
|
logcmd = "journalctl -f -u dovecot"
|
||||||
|
name = "dovecot"
|
||||||
|
|
||||||
def __init__(self, host):
|
def __init__(self, host):
|
||||||
self.host = host
|
self.host = host
|
||||||
@@ -82,7 +83,8 @@ def smtp(maildomain):
|
|||||||
|
|
||||||
class SmtpConn:
|
class SmtpConn:
|
||||||
AuthError = smtplib.SMTPAuthenticationError
|
AuthError = smtplib.SMTPAuthenticationError
|
||||||
logunit = "postfix"
|
logcmd = "journalctl -f -t postfix/smtpd -t postfix/smtp -t postfix/lmtp"
|
||||||
|
name = "postfix"
|
||||||
|
|
||||||
def __init__(self, host):
|
def __init__(self, host):
|
||||||
self.host = host
|
self.host = host
|
||||||
@@ -188,8 +190,8 @@ class RemoteLog:
|
|||||||
def __init__(self, sshdomain):
|
def __init__(self, sshdomain):
|
||||||
self.sshdomain = sshdomain
|
self.sshdomain = sshdomain
|
||||||
|
|
||||||
def iter(self, unit=""):
|
def iter(self, logcmd=""):
|
||||||
getjournal = f"journalctl -f -u {unit}" if unit else "journalctl -f"
|
getjournal = f"journalctl -f" if not logcmd else logcmd
|
||||||
self.popen = subprocess.Popen(
|
self.popen = subprocess.Popen(
|
||||||
["ssh", f"root@{self.sshdomain}", getjournal],
|
["ssh", f"root@{self.sshdomain}", getjournal],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
def test_remotelog(remotelog, imap_or_smtp):
|
def test_remotelog(remotelog, imap_or_smtp):
|
||||||
lineproducer = remotelog.iter(imap_or_smtp.logunit)
|
lineproducer = remotelog.iter(imap_or_smtp.logcmd)
|
||||||
imap_or_smtp.connect()
|
imap_or_smtp.connect()
|
||||||
assert imap_or_smtp.logunit in next(lineproducer)
|
assert imap_or_smtp.name in next(lineproducer)
|
||||||
|
|
||||||
|
|
||||||
def test_use_two_chatmailservers(cmfactory, maildomain2):
|
def test_use_two_chatmailservers(cmfactory, maildomain2):
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class TestEndToEndDeltaChat:
|
|||||||
|
|
||||||
addr = ac2.get_config("addr").lower()
|
addr = ac2.get_config("addr").lower()
|
||||||
saved_ok = 0
|
saved_ok = 0
|
||||||
for line in remotelog.iter("dovecot"):
|
for line in remotelog.iter("journalctl -f -u dovecot"):
|
||||||
if addr not in line:
|
if addr not in line:
|
||||||
# print(line)
|
# print(line)
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user