mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +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
31 lines
735 B
Python
31 lines
735 B
Python
|
|
|
|
class CallbackServer(object):
|
|
|
|
def __init__(self, listen_port):
|
|
self.listen_port = listen_port
|
|
self.stop_serving = False
|
|
|
|
from log import LogServer
|
|
self.log_server = LogServer()
|
|
|
|
def start(self, rpc_server):
|
|
import Pyro4
|
|
Pyro4.config.COMMTIMEOUT = 0.5
|
|
daemon = Pyro4.Daemon('localhost', port=self.listen_port, unixsocket=None)
|
|
daemon.register(self.log_server)
|
|
|
|
def serve():
|
|
daemon.requestLoop(loopCondition=lambda: not self.stop_serving)
|
|
from threading import Thread
|
|
self.thread = Thread(target=serve)
|
|
self.thread.start()
|
|
|
|
rpc_server.set_log_server(self.log_server)
|
|
|
|
def stop(self):
|
|
self.stop_serving = True
|
|
if hasattr(self, 'thread'):
|
|
print('joining')
|
|
self.thread.join()
|
|
print('joined')
|