mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00

The work consists of three parts: * Allow for bootstrapping remotely, this makes it possible to run the tests on e.g. OSX with VirtualBox installed * Make bootstrapping a fully automated process where the manifests can be generated by the tests and the tests can call the bootstrapper directly in python * Create a framework wherein instances can be booted up using the bootstrapped images and subsequently tested
28 lines
985 B
Python
28 lines
985 B
Python
|
|
|
|
class RemoteServer(object):
|
|
|
|
def __init__(self):
|
|
import random
|
|
self.server_port = random.randrange(1024, 65535)
|
|
self.client_port = random.randrange(1024, 65535)
|
|
|
|
def start(self):
|
|
import subprocess
|
|
|
|
command = ['ssh', '-i', '/Users/anders/.vagrant.d/insecure_private_key',
|
|
'-t', # Force pseudo-tty allocation so that server.py quits when we close the connection
|
|
'-p', '2222',
|
|
'-L' + str(self.server_port) + ':localhost:' + str(self.server_port),
|
|
'-R' + str(self.client_port) + ':localhost:' + str(self.client_port),
|
|
'vagrant@localhost',
|
|
'--',
|
|
'sudo', '/root/bootstrap/remote/server.py',
|
|
'--listen-port', str(self.server_port),
|
|
'--callback-port', str(self.client_port)]
|
|
self.process = subprocess.Popen(args=command)
|
|
import time
|
|
time.sleep(2)
|
|
|
|
def stop(self):
|
|
self.process.terminate()
|