From 68d12e8a2236824fa081ca324a6e4b53ffcf26ad Mon Sep 17 00:00:00 2001 From: Juliana Rodrigueiro Date: Wed, 6 Feb 2019 11:57:52 +0100 Subject: [PATCH] Use a more robust condition in wait_for_email_transfer This solution uses 'postqueue -j' command, which will produce an empty list for stdout only when there are no more emails in the queue. We become independent of the format of the output (byte, string, specific characters, etc) --- src/arnied_wrapper.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/arnied_wrapper.py b/src/arnied_wrapper.py index fc5dc1b..c1666bd 100644 --- a/src/arnied_wrapper.py +++ b/src/arnied_wrapper.py @@ -314,7 +314,7 @@ def wait_for_email_transfer(timeout=300, vm=None): run_cmd(cmd='postqueue -f', vm=vm) log.info('Waiting for SMTP queue to be empty (%i/%i sec)', i, timeout) - if b'Mail queue is empty' in run_cmd(cmd='mailq', vm=vm).stdout: + if not run_cmd(cmd='postqueue -j', vm=vm).stdout: break time.sleep(1) log.debug('SMTP queue is empty') -- 1.7.1