From 4cde71552fa42b47f527efd366ba55566c096be8 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 23 Jun 2016 16:38:39 +0200 Subject: [PATCH] buildserver: run_via_vagrant_ssh() to run cmds via python-vagrant This moves the last vagrant call in a subprocess. --- makebuildserver | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/makebuildserver b/makebuildserver index 828b51fc..6578e27c 100755 --- a/makebuildserver +++ b/makebuildserver @@ -293,6 +293,14 @@ def sha256_for_file(path): return s.hexdigest() +def run_via_vagrant_ssh(v, cmdlist): + if (isinstance(cmdlist, str) or isinstance(cmdlist, bytes)): + cmd = cmdlist + else: + cmd = ' '.join(cmdlist) + v._run_vagrant_command(['ssh', '-c', cmd]) + + def main(): global cachedir, cachefiles, config, tail @@ -434,10 +442,7 @@ def main(): universal_newlines=True) buildserverid = p.communicate()[0].strip() print("...ID is " + buildserverid) - subprocess.call( - ['vagrant', 'ssh', '-c', 'sh -c "echo {0} >/home/vagrant/buildserverid"' - .format(buildserverid)], - cwd=serverdir) + run_via_vagrant_ssh(v, 'sh -c "echo %s >/home/vagrant/buildserverid"' % buildserverid) print("Stopping build server VM") v.halt()