Currently defined keyword arguments:
+ env=<var>=<value>
+
+ Sets the environment variable <var> to <value>.
+
debug=<tfd>-<hfd>
Arranges to pass fd <tfd> the testbed command, and
send all output to it to the fd <hfd> as passed
by the virt server's caller.
- If this feature is available, execute-debug will
- be advertised. Only one such plumbing is available.
-
<tfd> may be 1 or 2, in which case no output will
be written to the <stdout> or <stderr> files.
+ If this feature is available, execute-debug will
+ be advertised. Only one such plumbing is available.
+
* Commands
copydown <host-tree> <testbed-path>
copyup <testbed-tree> <host-path>
cmdnumargs(c, ce, 5, None)
debug_re = regexp.compile('debug=(\d+)\-(\d+)$')
debug_g = None
+ envs = []
for kw in ce[6:]:
if kw.startswith('debug='):
if debug_g: bomb("multiple debug= in execute")
m = debug_re.match(kw)
if not m: bomb("invalid execute debug arg `%s'" % kw)
debug_g = m.groups()
+ elif kw.startswith('env='):
+ es = kw[4:]; eq = es.find('=')
+ if eq <= 0: bomb("invalid env arg `%s'" % kw)
+ envs.append((es[:eq], es[eq+1:]))
else: bomb("invalid execute kw arg `%s'" % kw)
gobody = " import sys\n"
if ioe == tfd: ioe_tfd = -1
gobody += " setfd(%d,'%s',%d)\n" % (
ioe_tfd, ce[ioe+2], ioe>0 )
+ for e in envs:
+ gobody += (" os.environ[urllib.unquote('%s')]"
+ " = urllib.unquote('%s')\n"
+ % tuple(map(urllib.quote, e)))
gobody += " os.chdir(urllib.unquote('" + ce[5] +"'))\n"
gobody += " cmd = '%s'\n" % ce[1]
gobody += (" cmd = cmd.split(',')\n"