1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-07-07 09:50:07 +02:00

buildserver: run_via_vagrant_ssh() to run cmds via python-vagrant

This moves the last vagrant call in a subprocess.
This commit is contained in:
Hans-Christoph Steiner 2016-06-23 16:38:39 +02:00
parent 6464ec55b7
commit 4cde71552f

View File

@ -293,6 +293,14 @@ def sha256_for_file(path):
return s.hexdigest() 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(): def main():
global cachedir, cachefiles, config, tail global cachedir, cachefiles, config, tail
@ -434,10 +442,7 @@ def main():
universal_newlines=True) universal_newlines=True)
buildserverid = p.communicate()[0].strip() buildserverid = p.communicate()[0].strip()
print("...ID is " + buildserverid) print("...ID is " + buildserverid)
subprocess.call( run_via_vagrant_ssh(v, 'sh -c "echo %s >/home/vagrant/buildserverid"' % buildserverid)
['vagrant', 'ssh', '-c', 'sh -c "echo {0} >/home/vagrant/buildserverid"'
.format(buildserverid)],
cwd=serverdir)
print("Stopping build server VM") print("Stopping build server VM")
v.halt() v.halt()