Nodes are note created in examples now

To be able test examples in different envs nodes can not be created in examples.
Now before running an example nodes should be created manually. For fuel-devops
nodes will be created automaticly in run.sh script
This commit is contained in:
Łukasz Oleś 2016-02-01 14:09:43 +01:00
parent 7cd4e07d00
commit da3fd7dcb6
3 changed files with 11 additions and 26 deletions
examples
hosts_file
openstack
riak

@ -1,21 +1,11 @@
#!/usr/bin/python
import click
import sys
import time
from solar.core import signals
from solar.core.resource import composer as cr
from solar.dblayer.model import ModelMeta
from solar.core.resource import resource as rs
def run():
ModelMeta.remove_all()
resources = cr.create('nodes', 'templates/nodes', {'count': 2})
node1, node2 = [x for x in resources if x.name.startswith('node')]
hosts1, hosts2 = [x for x in resources
if x.name.startswith('hosts_file')]
node1, node2 = rs.load_all(startswith='node')[:2]
hosts1, hosts2 = rs.load_all(startswith='hosts_file')[:2]
node1.connect(hosts1, {
'name': 'hosts:name',

@ -40,8 +40,7 @@ def main():
def prepare_nodes(nodes_count):
resources = cr.create('nodes', 'templates/nodes', {"count": nodes_count})
nodes = resources.like('node')
nodes = resource.load_all(startswith='node')
resources = cr.create('nodes_network', 'templates/nodes_network', {"count": nodes_count})
nodes_sdn = resources.like('node')
r = {}
@ -826,7 +825,6 @@ def create_compute(node):
@click.command()
def create_all():
ModelMeta.remove_all()
r = prepare_nodes(2)
r.update(create_controller('node1'))
r.update(create_compute('node2'))

@ -18,6 +18,7 @@ from solar.core import resource
from solar.core import signals
from solar.core import validation
from solar.core.resource import composer as cr
from solar.core.resource import resource as rs
from solar import errors
from solar.dblayer.model import ModelMeta
@ -29,13 +30,9 @@ from solar.dblayer.solar_models import Resource
def setup_riak():
ModelMeta.remove_all()
resources = cr.create('nodes', 'templates/nodes', {'count': 3})
nodes = resources.like('node')
hosts_services = resources.like('hosts_file')
node1, node2, node3 = nodes
nodes = rs.load_all(startswith='node')
hosts_services = rs.load_all(startswith='hosts_file')
node1, node2, node3 = nodes[:3]
riak_services = []
ips = '10.0.0.%d'
@ -73,9 +70,9 @@ def setup_riak():
sys.exit(1)
events = [
Dep('hosts_file1', 'run', 'success', 'riak_service1', 'run'),
Dep('hosts_file2', 'run', 'success', 'riak_service2', 'run'),
Dep('hosts_file3', 'run', 'success', 'riak_service3', 'run'),
Dep('hosts_file_node_node1', 'run', 'success', 'riak_service1', 'run'),
Dep('hosts_file_node_node2', 'run', 'success', 'riak_service2', 'run'),
Dep('hosts_file_node_node3', 'run', 'success', 'riak_service3', 'run'),
React('riak_service2', 'run', 'success', 'riak_service2', 'join'),
React('riak_service3', 'run', 'success', 'riak_service3', 'join'),