From b66dac0079eaece8753eed4e868d2e3591439ed8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Diemer?= <stephane.diemer@ubicast.eu>
Date: Tue, 9 Jul 2019 10:16:54 +0200
Subject: [PATCH] Fixed log messages in postfix setup

---
 2.Common_services/1.Postfix/0_setup.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/2.Common_services/1.Postfix/0_setup.py b/2.Common_services/1.Postfix/0_setup.py
index 9217e79b..9807ca0f 100644
--- a/2.Common_services/1.Postfix/0_setup.py
+++ b/2.Common_services/1.Postfix/0_setup.py
@@ -36,8 +36,8 @@ def setup(interactive=True):
     ])
     # Configure mail sender
     sender = utils.get_conf('EMAIL_SENDER', '').strip(' \t@')
-    if sender.count('@') != 1:
-        utils.log('Invalid sender address: "%s" (one "@" must be in the sender address).')
+    if sender and sender.count('@') != 1:
+        utils.log('Invalid sender address: "%s" (one "@" must be in the sender address).' % sender)
         sender = None
     if not sender and hostname:
         if utils.get_conf('MS_SERVER_NAME', '') not in ('', 'mediaserver'):
@@ -46,7 +46,10 @@ def setup(interactive=True):
             sender = '%s@%s' % (hostname, utils.get_conf('CM_SERVER_NAME'))
         elif utils.get_conf('MONITOR_SERVER_NAME', '') not in ('', 'monitor'):
             sender = '%s@%s' % (hostname, utils.get_conf('MONITOR_SERVER_NAME'))
-    if sender:
+    if not sender:
+        utils.warning('No sender address found.')
+    else:
+        utils.log('Sender address is "%s".' % sender)
         cmds.extend([
             'rm -f /etc/postfix/generic',
             'echo "root@localhost %s" >> /etc/postfix/generic' % sender,
-- 
GitLab