Merge pull request #203 from loles/vr_transport
Virtual resources and new transports
This commit is contained in:
commit
a4c2bbd14e
@ -3,30 +3,29 @@ id: riak_node
|
|||||||
resources:
|
resources:
|
||||||
- id: riak_service0
|
- id: riak_service0
|
||||||
from: resources/riak_node
|
from: resources/riak_node
|
||||||
|
location: {{nodes[0]}}
|
||||||
values:
|
values:
|
||||||
riak_self_name: 'riak0'
|
riak_self_name: 'riak0'
|
||||||
riak_hostname: 'riak_server0.solar'
|
riak_hostname: 'riak_server0.solar'
|
||||||
riak_name: 'riak0@riak_server0.solar'
|
riak_name: 'riak0@riak_server0.solar'
|
||||||
ip: '{{nodes[0]}}::ip'
|
ip: '{{nodes[0]}}::ip'
|
||||||
ssh_user: '{{nodes[0]}}::ssh_user'
|
|
||||||
ssh_key: '{{nodes[0]}}::ssh_key'
|
|
||||||
|
|
||||||
{% for i in range(1, idx|int) %}
|
{% for i in range(1, idx|int) %}
|
||||||
- id: riak_service{{i}}
|
- id: riak_service{{i}}
|
||||||
from: resources/riak_node
|
from: resources/riak_node
|
||||||
|
location: {{nodes[i]}}
|
||||||
values:
|
values:
|
||||||
riak_self_name: 'riak{{i}}'
|
riak_self_name: 'riak{{i}}'
|
||||||
riak_hostname: 'riak_server{{i}}.solar'
|
riak_hostname: 'riak_server{{i}}.solar'
|
||||||
riak_name: 'riak{{i}}@riak_server{{i}}.solar'
|
riak_name: 'riak{{i}}@riak_server{{i}}.solar'
|
||||||
join_to: 'riak_service0::riak_name'
|
join_to: 'riak_service0::riak_name'
|
||||||
ip: '{{nodes[i]}}::ip'
|
ip: '{{nodes[i]}}::ip'
|
||||||
ssh_user: '{{nodes[i]}}::ssh_user'
|
|
||||||
ssh_key: '{{nodes[i]}}::ssh_key'
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% for i in range(idx|int) %}
|
{% for i in range(idx|int) %}
|
||||||
- id: hosts_file{{i}}
|
- id: hosts_file{{i}}
|
||||||
from: resources/hosts_file
|
from: resources/hosts_file
|
||||||
|
location: {{nodes[i]}}
|
||||||
values:
|
values:
|
||||||
hosts:name:
|
hosts:name:
|
||||||
{% for j in range(idx|int) %}
|
{% for j in range(idx|int) %}
|
||||||
@ -36,18 +35,14 @@ resources:
|
|||||||
{% for j in range(idx|int) %}
|
{% for j in range(idx|int) %}
|
||||||
- riak_service{{j}}::ip::NO_EVENTS
|
- riak_service{{j}}::ip::NO_EVENTS
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
ip: '{{nodes[i]}}::ip'
|
|
||||||
ssh_user: '{{nodes[i]}}::ssh_user'
|
|
||||||
ssh_key: '{{nodes[i]}}::ssh_key'
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% for i in range(idx|int) %}
|
- id: haproxy_riak_config_http
|
||||||
- id: haproxy_service_config_http{{i}}
|
|
||||||
from: resources/haproxy_service_config
|
from: resources/haproxy_service_config
|
||||||
values:
|
values:
|
||||||
listen_port: 8098
|
listen_port: 8098
|
||||||
protocol: 'http'
|
protocol: 'http'
|
||||||
name: 'riak_haproxy_http{{i}}'
|
name: 'riak_haproxy_http'
|
||||||
backends:server:
|
backends:server:
|
||||||
{% for j in range(idx|int) %}
|
{% for j in range(idx|int) %}
|
||||||
- riak_service{{j}}::riak_hostname
|
- riak_service{{j}}::riak_hostname
|
||||||
@ -56,15 +51,13 @@ resources:
|
|||||||
{% for j in range(idx|int) %}
|
{% for j in range(idx|int) %}
|
||||||
- riak_service{{j}}::riak_port_http
|
- riak_service{{j}}::riak_port_http
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{% for i in range(idx|int) %}
|
- id: haproxy_riak_config_pb
|
||||||
- id: haproxy_service_config_pb{{i}}
|
|
||||||
from: resources/haproxy_service_config
|
from: resources/haproxy_service_config
|
||||||
values:
|
values:
|
||||||
listen_port: 8087
|
listen_port: 8087
|
||||||
protocol: 'tcp'
|
protocol: 'tcp'
|
||||||
name: 'riak_haproxy_pb{{i}}'
|
name: 'riak_haproxy_pb'
|
||||||
backends:server:
|
backends:server:
|
||||||
{% for j in range(idx|int) %}
|
{% for j in range(idx|int) %}
|
||||||
- riak_service{{j}}::riak_hostname
|
- riak_service{{j}}::riak_hostname
|
||||||
@ -73,36 +66,33 @@ resources:
|
|||||||
{% for j in range(idx|int) %}
|
{% for j in range(idx|int) %}
|
||||||
- riak_service{{j}}::riak_port_pb
|
- riak_service{{j}}::riak_port_pb
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{% for i in range(idx|int) %}
|
{% for i in range(idx|int) %}
|
||||||
- id: haproxy_config{{i}}
|
- id: haproxy_config{{i}}
|
||||||
from: resources/haproxy_config
|
from: resources/haproxy_config
|
||||||
|
location: {{nodes[i]}}
|
||||||
values:
|
values:
|
||||||
config:protocol:
|
config:protocol:
|
||||||
- haproxy_service_config_http{{i}}::protocol
|
- haproxy_riak_config_http::protocol
|
||||||
- haproxy_service_config_pb{{i}}::protocol
|
- haproxy_riak_config_pb::protocol
|
||||||
config:listen_port:
|
config:listen_port:
|
||||||
- haproxy_service_config_http{{i}}::listen_port
|
- haproxy_riak_config_http::listen_port
|
||||||
- haproxy_service_config_pb{{i}}::listen_port
|
- haproxy_riak_config_pb::listen_port
|
||||||
config:name:
|
config:name:
|
||||||
- haproxy_service_config_http{{i}}::name
|
- haproxy_riak_config_http::name
|
||||||
- haproxy_service_config_pb{{i}}::name
|
- haproxy_riak_config_pb::name
|
||||||
config:backends:
|
config:backends:
|
||||||
- haproxy_service_config_http{{i}}::backends
|
- haproxy_riak_config_http::backends
|
||||||
- haproxy_service_config_pb{{i}}::backends
|
- haproxy_riak_config_pb::backends
|
||||||
ip: '{{nodes[i]}}::ip'
|
ip: '{{nodes[i]}}::ip'
|
||||||
ssh_user: '{{nodes[i]}}::ssh_user'
|
|
||||||
ssh_key: '{{nodes[i]}}::ssh_key'
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% for i in range(idx|int) %}
|
{% for i in range(idx|int) %}
|
||||||
- id: haproxy_service{{i}}
|
- id: haproxy_service{{i}}
|
||||||
|
location: {{nodes[i]}}
|
||||||
from: resources/haproxy_service
|
from: resources/haproxy_service
|
||||||
values:
|
values:
|
||||||
ip: '{{nodes[i]}}::ip'
|
ip: '{{nodes[i]}}::ip'
|
||||||
ssh_user: '{{nodes[i]}}::ssh_user'
|
|
||||||
ssh_key: '{{nodes[i]}}::ssh_key'
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,11 +117,16 @@ def create_resources(resources):
|
|||||||
for r in resources:
|
for r in resources:
|
||||||
resource_name = r['id']
|
resource_name = r['id']
|
||||||
args = r['values']
|
args = r['values']
|
||||||
|
node = r.get('location', None)
|
||||||
from_path = r.get('from', None)
|
from_path = r.get('from', None)
|
||||||
base_path = os.path.join(cwd, from_path)
|
base_path = os.path.join(cwd, from_path)
|
||||||
new_resources = create(resource_name, base_path)
|
new_resources = create(resource_name, base_path)
|
||||||
created_resources += new_resources
|
created_resources += new_resources
|
||||||
if not is_virtual(base_path):
|
if not is_virtual(base_path):
|
||||||
|
if node:
|
||||||
|
node = load_resource(node)
|
||||||
|
r = load_resource(resource_name)
|
||||||
|
signals.connect(node, r, {})
|
||||||
update_inputs(resource_name, args)
|
update_inputs(resource_name, args)
|
||||||
return created_resources
|
return created_resources
|
||||||
|
|
||||||
|
@ -90,7 +90,8 @@ def location_and_transports(emitter, receiver, orig_mapping):
|
|||||||
|
|
||||||
|
|
||||||
def connect(emitter, receiver, mapping=None, events=None):
|
def connect(emitter, receiver, mapping=None, events=None):
|
||||||
mapping = mapping or guess_mapping(emitter, receiver)
|
if mapping is None:
|
||||||
|
mapping = guess_mapping(emitter, receiver)
|
||||||
|
|
||||||
# XXX: we didn't agree on that "reverse" there
|
# XXX: we didn't agree on that "reverse" there
|
||||||
location_and_transports(emitter, receiver, mapping)
|
location_and_transports(emitter, receiver, mapping)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user