cpushare (0.48-4) 203_hostname.diff

Summary

 cpushare/client.py |   21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

    
download this patch

Patch contents

Index: cpushare-0.48/cpushare/client.py
===================================================================
--- cpushare-0.48.orig/cpushare/client.py	2008-07-24 15:12:04.000000000 +0000
+++ cpushare-0.48/cpushare/client.py	2008-07-24 15:24:25.000000000 +0000
@@ -54,22 +54,33 @@
 
 	from cpushare.proto import cpushare_factory
 	factory = cpushare_factory()
+
 	cpushare_hostname = config.get('cpushare_hostname')
+	cpushare_ssl_cert = config.get('cpushare_cert')
+	cpushare_ssl_port = int(config.get('cpushare_port'))
 
 	order = file(config.get('order'))
 	if order.readline().strip() != ORDER_MAGIC:
 		raise ERROR, 'Order magic string is corrupted'
-	factory.order = order.readline().strip().split('_')
+	while True:
+		line = order.readline().strip()
+		if not line:
+			break
+		if line[:9] == "hostname:":
+			cpushare_hostname = line[10:].strip()
+		elif line[:5] == "cert:":
+			cpushare_ssl_cert = line[6:].strip()
+		elif line[:5] == "port:":
+			cpushare_port_file = line[6:].strip()
+		else:
+			factory.order = line.split('_')
 	order.close()
 
 	factory.seccomp_loader = config.get('seccomp_loader')
 	factory.cache_dir = config.get('cache_dir')
-
 	factory.max_ram_mbytes_per_cpu = max_ram_mbytes_per_cpu()
+	factory.server_certificate = file(cpushare_ssl_cert).read()
 
-	server_certificate = file(config.get('cpushare_cert')).read()
-	factory.server_certificate = server_certificate
-	cpushare_ssl_port = int(config.get('cpushare_port'))
 	client_context_factory = set_context_factory(factory)
 	internet.SSLClient(cpushare_hostname, cpushare_ssl_port, factory,
 			   client_context_factory).setServiceParent(service_collection)