[Treepkg-commits] r426 - in trunk: . bin

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Sep 9 16:46:13 CEST 2010


Author: aheinecke
Date: 2010-09-09 16:46:13 +0200 (Thu, 09 Sep 2010)
New Revision: 426

Modified:
   trunk/bin/sendnotificationmails.py
   trunk/demonotification.cfg
Log:
Allow sending notifications from a local treepkg via sendnotificationmails.py


Modified: trunk/bin/sendnotificationmails.py
===================================================================
--- trunk/bin/sendnotificationmails.py	2010-09-09 14:26:59 UTC (rev 425)
+++ trunk/bin/sendnotificationmails.py	2010-09-09 14:46:13 UTC (rev 426)
@@ -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:

Modified: trunk/demonotification.cfg
===================================================================
--- trunk/demonotification.cfg	2010-09-09 14:26:59 UTC (rev 425)
+++ trunk/demonotification.cfg	2010-09-09 14:46:13 UTC (rev 426)
@@ -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



More information about the Treepkg-commits mailing list