comparison bin/sendnotificationmails.py @ 576:8f62a825addb

Use shlex.split for build_listpanding command because the string may contain arguments like --config-file foo.cfg When returning lists cmdexpand replacement variable must use @ instead of $
author Bjoern Ricks <bricks@intevation.de>
date Sat, 03 Sep 2011 11:35:36 +0000
parents 7de7869962ef
children 7a9841e4958f
comparison
equal deleted inserted replaced
575:87a0be76b5b7 576:8f62a825addb
21 from treepkg.readconfig import read_config_section 21 from treepkg.readconfig import read_config_section
22 from treepkg.run import capture_output 22 from treepkg.run import capture_output
23 from treepkg.cmdexpand import cmdexpand 23 from treepkg.cmdexpand import cmdexpand
24 24
25 notification_desc = [("build_user", str, ""), ("build_host", str, ""), 25 notification_desc = [("build_user", str, ""), ("build_host", str, ""),
26 "build_listpending", "notification_template", 26 ("build_listpending", shlex.split),
27 "notification_template",
27 "smtp_host", ("smtp_port", int), 28 "smtp_host", ("smtp_port", int),
28 ] 29 ]
29 30
30 def read_config(filename): 31 def read_config(filename):
31 parser = SafeConfigParser() 32 parser = SafeConfigParser()
57 config = read_config(config_filename) 58 config = read_config(config_filename)
58 59
59 template = open(config["notification_template"]).read() 60 template = open(config["notification_template"]).read()
60 61
61 if not config.get("build_user") or not config.get("build_host"): 62 if not config.get("build_user") or not config.get("build_host"):
62 lines = capture_output(cmdexpand("$build_listpending", **config)) 63 lines = capture_output(cmdexpand("@build_listpending", **config))
63 else: 64 else:
64 lines = capture_output(cmdexpand("ssh $build_user$@$build_host" 65 lines = capture_output(cmdexpand("ssh $build_user$@$build_host"
65 " $build_listpending", 66 " @build_listpending",
66 **config)) 67 **config))
67 for line in lines.splitlines(): 68 for line in lines.splitlines():
68 words = line.split() 69 words = line.split()
69 if len(words) == 4: 70 if len(words) == 4:
70 status, track, revision, rules_revision = words 71 status, track, revision, rules_revision = words
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)