Fixed hosts_file resources duplicates in riak examples
This commit is contained in:
parent
96c002d216
commit
fcc7bdbddb
@ -34,6 +34,7 @@ def setup_riak():
|
|||||||
|
|
||||||
resources = vr.create('nodes', 'templates/nodes.yaml', {'count': 3})
|
resources = vr.create('nodes', 'templates/nodes.yaml', {'count': 3})
|
||||||
nodes = [x for x in resources if x.name.startswith('node')]
|
nodes = [x for x in resources if x.name.startswith('node')]
|
||||||
|
hosts_services = [x for x in resources if x.name.startswith('hosts_file')]
|
||||||
node1, node2, node3 = nodes
|
node1, node2, node3 = nodes
|
||||||
|
|
||||||
riak_services = []
|
riak_services = []
|
||||||
@ -53,14 +54,6 @@ def setup_riak():
|
|||||||
for i, riak in enumerate(riak_services[1:]):
|
for i, riak in enumerate(riak_services[1:]):
|
||||||
riak_services[0].connect(riak, {'riak_name': 'join_to'})
|
riak_services[0].connect(riak, {'riak_name': 'join_to'})
|
||||||
|
|
||||||
hosts_services = []
|
|
||||||
for i, riak in enumerate(riak_services):
|
|
||||||
num = i + 1
|
|
||||||
hosts_file = vr.create('hosts_file%d' % num,
|
|
||||||
'resources/hosts_file', {})[0]
|
|
||||||
hosts_services.append(hosts_file)
|
|
||||||
nodes[i].connect(hosts_file)
|
|
||||||
|
|
||||||
for riak in riak_services:
|
for riak in riak_services:
|
||||||
for hosts_file in hosts_services:
|
for hosts_file in hosts_services:
|
||||||
riak.connect_with_events(hosts_file,
|
riak.connect_with_events(hosts_file,
|
||||||
|
@ -30,6 +30,7 @@ def setup_riak(nodes_num=None, hosts_mapping=False):
|
|||||||
|
|
||||||
resources = vr.create('nodes', 'templates/nodes.yaml', {'count': nodes_num})
|
resources = vr.create('nodes', 'templates/nodes.yaml', {'count': nodes_num})
|
||||||
nodes = [x for x in resources if x.name.startswith('node')]
|
nodes = [x for x in resources if x.name.startswith('node')]
|
||||||
|
hosts_services = [x for x in resources if x.name.startswith('hosts_file')]
|
||||||
|
|
||||||
riak_services = []
|
riak_services = []
|
||||||
ips = '10.0.0.%d'
|
ips = '10.0.0.%d'
|
||||||
@ -48,14 +49,6 @@ def setup_riak(nodes_num=None, hosts_mapping=False):
|
|||||||
for i, riak in enumerate(riak_services[1:]):
|
for i, riak in enumerate(riak_services[1:]):
|
||||||
riak_services[0].connect(riak, {'riak_name': 'join_to'})
|
riak_services[0].connect(riak, {'riak_name': 'join_to'})
|
||||||
|
|
||||||
hosts_services = []
|
|
||||||
for i, riak in enumerate(riak_services):
|
|
||||||
num = i + 1
|
|
||||||
hosts_file = vr.create('hosts_file%d' % num,
|
|
||||||
'resources/hosts_file', {})[0]
|
|
||||||
hosts_services.append(hosts_file)
|
|
||||||
nodes[i].connect(hosts_file)
|
|
||||||
|
|
||||||
if hosts_mapping:
|
if hosts_mapping:
|
||||||
for riak in riak_services:
|
for riak in riak_services:
|
||||||
for hosts_file in hosts_services:
|
for hosts_file in hosts_services:
|
||||||
|
Loading…
Reference in New Issue
Block a user