changeset 466:e4c0beab5328

Allow sending notifications from a local treepkg via sendnotificationmails.py
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 09 Sep 2010 14:46:13 +0000
parents 296d26453e2a
children 7fd8af79e652
files bin/sendnotificationmails.py demonotification.cfg
diffstat 2 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/bin/sendnotificationmails.py	Thu Sep 09 14:26:59 2010 +0000
+++ b/bin/sendnotificationmails.py	Thu Sep 09 14:46:13 2010 +0000
@@ -20,8 +20,8 @@
 from treepkg.run import capture_output
 from treepkg.cmdexpand import cmdexpand
 
-notification_desc = ["build_user", "build_host", "build_listpending",
-                     "notification_template",
+notification_desc = [("build_user", str, ""), ("build_host", str, ""),
+                     "build_listpending", "notification_template",
                      "smtp_host", ("smtp_port", int),
                      ]
 
@@ -56,9 +56,12 @@
 
     template = open(config["notification_template"]).read()
 
-    lines = capture_output(cmdexpand("ssh $build_user$@$build_host"
-                                     " $build_listpending",
-                                     **config))
+    if not config.get("build_user") or not config.get("build_host"):
+        lines = capture_output(cmdexpand("$build_listpending", **config))
+    else:
+        lines = capture_output(cmdexpand("ssh $build_user$@$build_host"
+                                         " $build_listpending",
+                                         **config))
     for line in lines.splitlines():
         words = line.split()
         if len(words) == 4:
--- a/demonotification.cfg	Thu Sep 09 14:26:59 2010 +0000
+++ b/demonotification.cfg	Thu Sep 09 14:46:13 2010 +0000
@@ -5,12 +5,13 @@
 
 [notification]
 
-# Username and host on which the treepackager runs.
+# Username and host on which the a remote treepackager runs.
+# Leave commented if treepkg runs locally
 # sendnotificationmails.py has to be able to connect to that host as the
 # builduser via ssh without knowing the password.  This is best
 # achieved with the ssh-agent.
-build_user: builder
-build_host: localhost
+# build_user: builder
+# build_host: localhost
 
 # the program to run on build_host to list the pending notifications
 # currently sendnotificationmails.py assumes that the default
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)