... |
... |
@@ -49,41 +49,46 @@ def start(context, config): |
49
|
49
|
with open(config) as f:
|
50
|
50
|
settings = parser.get_parser().safe_load(f)
|
51
|
51
|
|
52
|
|
- server_settings = settings['server']
|
53
|
|
- insecure_mode = server_settings['insecure-mode']
|
|
52
|
+ try:
|
|
53
|
+ server_settings = settings['server']
|
|
54
|
+ insecure_mode = server_settings['insecure-mode']
|
|
55
|
+
|
|
56
|
+ credentials = None
|
|
57
|
+ if not insecure_mode:
|
|
58
|
+ server_key = server_settings['tls-server-key']
|
|
59
|
+ server_cert = server_settings['tls-server-cert']
|
|
60
|
+ client_certs = server_settings['tls-client-certs']
|
|
61
|
+ credentials = context.load_server_credentials(server_key, server_cert, client_certs)
|
54
|
62
|
|
55
|
|
- credentials = None
|
56
|
|
- if not insecure_mode:
|
57
|
|
- server_key = server_settings['tls-server-key']
|
58
|
|
- server_cert = server_settings['tls-server-cert']
|
59
|
|
- client_certs = server_settings['tls-client-certs']
|
60
|
|
- credentials = context.load_server_credentials(server_key, server_cert, client_certs)
|
|
63
|
+ if not credentials:
|
|
64
|
+ click.echo("ERROR: no TLS keys were specified and no defaults could be found.\n" +
|
|
65
|
+ "Set `insecure-mode: false` in order to deactivate TLS encryption.\n", err=True)
|
|
66
|
+ sys.exit(-1)
|
61
|
67
|
|
62
|
|
- if not credentials:
|
63
|
|
- click.echo("ERROR: no TLS keys were specified and no defaults could be found.\n" +
|
64
|
|
- "Set `insecure-mode: false` in order to deactivate TLS encryption.\n", err=True)
|
65
|
|
- sys.exit(-1)
|
|
68
|
+ port = server_settings['port']
|
|
69
|
+ instances = settings['instances']
|
66
|
70
|
|
67
|
|
- instances = settings['instances']
|
|
71
|
+ execution_controllers = _instance_maker(instances, ExecutionController)
|
68
|
72
|
|
69
|
|
- execution_controllers = _instance_maker(instances, ExecutionController)
|
|
73
|
+ execution_instances = {}
|
|
74
|
+ bots_interfaces = {}
|
|
75
|
+ operations_instances = {}
|
70
|
76
|
|
71
|
|
- execution_instances = {}
|
72
|
|
- bots_interfaces = {}
|
73
|
|
- operations_instances = {}
|
|
77
|
+ # TODO: map properly in parser
|
|
78
|
+ for k, v in execution_controllers.items():
|
|
79
|
+ execution_instances[k] = v.execution_instance
|
|
80
|
+ bots_interfaces[k] = v.bots_interface
|
|
81
|
+ operations_instances[k] = v.operations_instance
|
74
|
82
|
|
75
|
|
- # TODO: map properly in parser
|
76
|
|
- for k, v in execution_controllers.items():
|
77
|
|
- execution_instances[k] = v.execution_instance
|
78
|
|
- bots_interfaces[k] = v.bots_interface
|
79
|
|
- operations_instances[k] = v.operations_instance
|
|
83
|
+ reference_caches = _instance_maker(instances, ReferenceCache)
|
|
84
|
+ action_caches = _instance_maker(instances, ActionCache)
|
|
85
|
+ cas = _instance_maker(instances, ContentAddressableStorageInstance)
|
|
86
|
+ bytestreams = _instance_maker(instances, ByteStreamInstance)
|
80
|
87
|
|
81
|
|
- reference_caches = _instance_maker(instances, ReferenceCache)
|
82
|
|
- action_caches = _instance_maker(instances, ActionCache)
|
83
|
|
- cas = _instance_maker(instances, ContentAddressableStorageInstance)
|
84
|
|
- bytestreams = _instance_maker(instances, ByteStreamInstance)
|
|
88
|
+ except KeyError as e:
|
|
89
|
+ click.echo("ERROR: Could not parse config: {}.\n".format(str(e)), err=True)
|
|
90
|
+ sys.exit(-1)
|
85
|
91
|
|
86
|
|
- port = server_settings['port']
|
87
|
92
|
server = BuildGridServer(port=port,
|
88
|
93
|
credentials=credentials,
|
89
|
94
|
execution_instances=execution_instances,
|