First stage of porting

This commit is contained in:
Jedrzej Nowak 2015-09-16 14:14:30 +02:00
parent ceed460d62
commit 68e3298d5c
4 changed files with 57 additions and 37 deletions

View File

@ -144,33 +144,45 @@ def setup_haproxies():
for single_hpsc in hpsc_http:
for riak in riaks:
signals.connect(riak, single_hpsc, {'riak_hostname': 'servers',
'riak_port_http': 'ports'})
# signals.connect(riak, single_hpsc, {'riak_hostname': 'servers',
# 'riak_port_http': 'ports'})
signals.connect(riak, single_hpsc, {'riak_hostname': 'backends:server',
'riak_port_http': 'backends:port'})
for single_hpsc in hpsc_pb:
for riak in riaks:
signals.connect(riak, single_hpsc, {'riak_hostname': 'servers',
'riak_port_pb': 'ports'})
# signals.connect(riak, single_hpsc, {'riak_hostname': 'servers',
# 'riak_port_pb': 'ports'})
signals.connect(riak, single_hpsc, {'riak_hostname': 'backends:server',
'riak_port_pb': 'backends:port'})
# haproxy config to haproxy service
for single_hpc, single_hpsc in zip(hpc, hpsc_http):
signals.connect(single_hpsc, single_hpc, {'protocol': 'configs_protocols',
'listen_port': 'listen_ports',
'name': 'configs_names',
'servers': 'configs',
'ports': 'configs_ports'})
# signals.connect(single_hpsc, single_hpc, {'protocol': 'configs_protocols',
# 'listen_port': 'listen_ports',
# 'name': 'configs_names',
# 'servers': 'configs',
# 'ports': 'configs_ports'})
signals.connect(single_hpsc, single_hpc, {"backends": "config:backends",
"listen_port": "config:listen_port",
"protocol": "config:protocol",
"name": "config:name"})
for single_hpc, single_hpsc in zip(hpc, hpsc_pb):
signals.connect(single_hpsc, single_hpc, {'protocol': 'configs_protocols',
'listen_port': 'listen_ports',
'name': 'configs_names',
'servers': 'configs',
'ports': 'configs_ports'})
# signals.connect(single_hpsc, single_hpc, {'protocol': 'configs_protocols',
# 'listen_port': 'listen_ports',
# 'name': 'configs_names',
# 'servers': 'configs',
# 'ports': 'configs_ports'})
signals.connect(single_hpsc, single_hpc, {"backends": "config:backends",
"listen_port": "config:listen_port",
"protocol": "config:protocol",
"name": "config:name"})
for single_hps, single_hpc in zip(hps, hpc):
signals.connect(single_hpc, single_hps, {'listen_ports': 'ports'},
events=False)
# for single_hps, single_hpc in zip(hps, hpc):
# signals.connect(single_hpc, single_hps, {'listen_ports': 'ports'},
# events=False)
# assign haproxy services to each node

View File

@ -8,20 +8,23 @@ input:
config_dir:
schema: {src: str!, dst: str!}
value: {src: /etc/solar/haproxy, dst: /etc/haproxy}
listen_ports:
schema: [int]
value: []
configs:
schema: [[str]]
value: []
configs_names:
schema: [str]
value: []
configs_ports:
schema: [[int]]
value: []
configs_protocols:
schema: [str]
# listen_ports:
# schema: [int]
# value: []
# configs:
# schema: [[str]]
# value: []
# configs_names:
# schema: [str]
# value: []
# configs_ports:
# schema: [[int]]
# value: []
# configs_protocols:
# schema: [str]
# value: []
config:
schema: [{backends: [{server: str!, port: int!}], listen_port: int!, protocol: str!, name: str!}]
value: []
ssh_user:
schema: str!

View File

@ -5,17 +5,19 @@ input:
name:
schema: str!
value: general_haproxy
backends:
schema: [{server: str!, port: int!}]
listen_port:
schema: int!
value: 9999
protocol:
schema: str!
value: http
ports:
schema: [int]
value: []
servers:
schema: [str]
value: []
# ports:
# schema: [int]
# value: []
# servers:
# schema: [str]
# value: []
tags: [resources/haproxy, resource/haproxy_general_config]

View File

@ -98,6 +98,9 @@ def _construct_jsonschema(schema, definition_base=''):
if schema == 'bool!':
return {'type': 'boolean'}, {}
print repr(schema)
print locals()
if isinstance(schema, list):
items, definitions = _construct_jsonschema(schema[0], definition_base=definition_base)