bootstrap-vz/bootstrapvz/base/remote/callback.py
Anders Ingemann e271f3e49a Initial work on integration testing started.
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
2015-04-16 22:15:17 +02:00

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')