From c92483bf01b3c9bca7fe87725db8b1326e7939fd Mon Sep 17 00:00:00 2001 From: Jedrzej Nowak Date: Mon, 28 Dec 2015 12:23:10 +0100 Subject: [PATCH] Replace all templates/(.*)\.yaml with templates/\1 Change-Id: I0d371595092323f9a87393954cd0cbdd3a72ac36 --- README.md | 4 ++-- doc/source/tutorials/wordpress.rst | 14 +++++++------- examples/cli/example.sh | 2 +- examples/hosts_file/hosts.py | 2 +- examples/librarian/README | 2 +- examples/library_ceph/README.md | 2 +- examples/library_ceph/ceph.py | 4 ++-- examples/lxc/example-lxc.py | 4 ++-- examples/openstack/openstack.py | 4 ++-- examples/provisioning/provision.py | 2 +- examples/riak/riak_cluster.yaml | 6 +++--- examples/riak/riaks-template.py | 2 +- examples/riak/riaks.py | 2 +- examples/riak/riaks_big.py | 2 +- templates/controller/1.0.0/controller.yaml | 6 +++--- templates/glance/1.0.0/glance.yaml | 2 +- 16 files changed, 30 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index e5dced03..25f4033e 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ Some very simple cluster setup: ```bash cd /vagrant -solar resource create nodes templates/nodes.yaml '{"count": 2}' +solar resource create nodes templates/nodes '{"count": 2}' solar resource create mariadb_service resources/mariadb_service '{"image": "mariadb", "root_password": "mariadb", "port": 3306}' solar resource create keystone_db resources/mariadb_db/ '{"db_name": "keystone_db", "login_user": "root"}' solar resource create keystone_db_user resources/mariadb_user/ user_name=keystone user_password=keystone # another valid format @@ -266,7 +266,7 @@ functional way, and in particular avoid `for` loops. Here's an example: ```python from solar import template -nodes = template.nodes_from('templates/riak_nodes.yaml') +nodes = template.nodes_from('templates/riak_nodes') riak_services = nodes.on_each( 'resources/riak_node', diff --git a/doc/source/tutorials/wordpress.rst b/doc/source/tutorials/wordpress.rst index d6295fd2..19c43e1c 100644 --- a/doc/source/tutorials/wordpress.rst +++ b/doc/source/tutorials/wordpress.rst @@ -5,7 +5,7 @@ Wordpress tutorial --------------- In this tutorial we will create Worpdress site using docker containers. We will create one container with Mysql database, then we will create database and user for it. After that we will create Wordpress container which is running on Apache. -For now you can use Solar only in our Vagrant environment. +For now you can use Solar only in our Vagrant environment. First checkout Solar repo and start vagrant. We need two virtual machines. One where Solar database and Orchestrator will run and one where we will install Wordpress and all components: 2. Solar installation @@ -36,7 +36,7 @@ First we need to create Solar Resource definition where global configuration wil Open meta file `/vagrant/tmp/wp_repo/wp_config/meta.yaml` with your favorite text editor and paste the following data: .. code-block:: yaml - + handler: none version: 1.0.0 input: @@ -56,7 +56,7 @@ Open meta file `/vagrant/tmp/wp_repo/wp_config/meta.yaml` with your favorite tex schema: str! value: -Let's go through this document line by line. `handler: none` says that this resource has no handler and no actions. In next line we define version. The most important part starts from line 3. We define there the inputs for this resource. It will be possible to configure following inputs: +Let's go through this document line by line. `handler: none` says that this resource has no handler and no actions. In next line we define version. The most important part starts from line 3. We define there the inputs for this resource. It will be possible to configure following inputs: * `db_root_pass` - Mysql root password * `db_port` - Mysql port @@ -71,12 +71,12 @@ In schema it's defined if input will be string or integer, `!` at the end means All other required resources are already available in solar repositores: `resources` and `templates`. We will use four more resources: -* resources/docker - it installs docker +* resources/docker - it installs docker * resources/docker_container - it manages docker container * resources/mariadb_db - it creates database in MariaDB and Mysql * resources/mariadb_user - it creates user in MariaDB and Mysql -There are three ways to create resources in Solar: Python API, CLI and Virtual Resources. We will use the last option. +There are three ways to create resources in Solar: Python API, CLI and Virtual Resources. We will use the last option. Virtual Resource is just a simple yaml file where we define all needed resources and connections. Create new file `/vagrant/tmp/wp_repo/docker.yaml`, open it and past the following data: @@ -97,7 +97,7 @@ Create new file `/vagrant/tmp/wp_repo/docker.yaml`, open it and past the followi wp_db_name: 'wp' wp_db_user: 'wp' wp_db_pass: 'h4ack' - + - id: mysql from: resources/docker_container location: node1 @@ -189,7 +189,7 @@ Now it's time to deploy our configuration. When running `vagrant up solar-dev so solar resource create nodes templates/nodes count=1 -It will create all required resources to run actions on solar-dev1. You can analyze `templates/nodes.yaml` later. Now we create resources defined in `docker.yaml` +It will create all required resources to run actions on solar-dev1. You can analyze content of `templates/nodes/1.0.0/nodes.yaml` later (that's the source for `templates/nodes`). Now we create resources defined in `docker` .. code-block:: bash diff --git a/examples/cli/example.sh b/examples/cli/example.sh index 2319779c..6f86fdeb 100755 --- a/examples/cli/example.sh +++ b/examples/cli/example.sh @@ -5,7 +5,7 @@ function deploy { # this two commands will clean db solar resource clear_all - solar resource create nodes templates/nodes.yaml '{"count": 1}' + solar resource create nodes templates/nodes '{"count": 1}' solar resource create mariadb1 /vagrant/resources/mariadb_service image=mariadb port=3306 solar connect node1 mariadb1 diff --git a/examples/hosts_file/hosts.py b/examples/hosts_file/hosts.py index 19342ced..ecce1957 100644 --- a/examples/hosts_file/hosts.py +++ b/examples/hosts_file/hosts.py @@ -10,7 +10,7 @@ from solar.dblayer.model import ModelMeta def run(): ModelMeta.remove_all() - resources = vr.create('nodes', 'templates/nodes.yaml', {'count': 2}) + resources = vr.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 diff --git a/examples/librarian/README b/examples/librarian/README index ca51c478..20b1caa0 100644 --- a/examples/librarian/README +++ b/examples/librarian/README @@ -5,7 +5,7 @@ Run it from /vagrant dir: ``` solar resource clear_all -solar resource create nodes templates/nodes.yaml '{"count": 1}' +solar resource create nodes templates/nodes '{"count": 1}' solar resource create librarian_example examples/librarian/librarian.yaml '{"node": "node1"}' solar changes stage diff --git a/examples/library_ceph/README.md b/examples/library_ceph/README.md index 1e19af44..97e6cc4f 100644 --- a/examples/library_ceph/README.md +++ b/examples/library_ceph/README.md @@ -26,5 +26,5 @@ solar res action run ceph_mon1 To add repositories use ``` -solar resource create apt1 templates/mos_repos.yaml node=node1 index=1 +solar resource create apt1 templates/mos_repos node=node1 index=1 ``` diff --git a/examples/library_ceph/ceph.py b/examples/library_ceph/ceph.py index 78d93e5c..f6f11d2d 100644 --- a/examples/library_ceph/ceph.py +++ b/examples/library_ceph/ceph.py @@ -33,7 +33,7 @@ NETWORK_METADATA = yaml.load(""" def deploy(): ModelMeta.remove_all() - resources = vr.create('nodes', 'templates/nodes.yaml', {'count': 2}) + resources = vr.create('nodes', 'templates/nodes', {'count': 2}) first_node, second_node = [x for x in resources if x.name.startswith('node')] first_transp = next(x for x in resources if x.name.startswith('transport')) @@ -60,7 +60,7 @@ def deploy(): })[0] managed_apt = vr.create( - 'managed_apt1', 'templates/mos_repos.yaml', + 'managed_apt1', 'templates/mos_repos', {'node': first_node.name, 'index': 0})[-1] keys.connect(ceph_mon, {}) diff --git a/examples/lxc/example-lxc.py b/examples/lxc/example-lxc.py index 01d6c7b7..43d9e1f2 100755 --- a/examples/lxc/example-lxc.py +++ b/examples/lxc/example-lxc.py @@ -45,8 +45,8 @@ def lxc_template(idx): def deploy(): ModelMeta.remove_all() - node1 = vr.create('nodes', 'templates/nodes.yaml', {})[0] - seed = vr.create('nodes', 'templates/seed_node.yaml', {})[0] + node1 = vr.create('nodes', 'templates/nodes', {})[0] + seed = vr.create('nodes', 'templates/seed_node', {})[0] ssh_key = vr.create('ssh_key1', 'resources/ssh_key', { 'keys_dir': '/vagrant/.ssh', diff --git a/examples/openstack/openstack.py b/examples/openstack/openstack.py index 8f0d28d3..502aa7a1 100755 --- a/examples/openstack/openstack.py +++ b/examples/openstack/openstack.py @@ -40,9 +40,9 @@ def main(): def prepare_nodes(nodes_count): - resources = vr.create('nodes', 'templates/nodes_with_transports.yaml', {"count": nodes_count}) + resources = vr.create('nodes', 'templates/nodes_with_transports', {"count": nodes_count}) nodes = [x for x in resources if x.name.startswith('node')] - resources = vr.create('nodes_network', 'templates/nodes_network.yaml', {"count": nodes_count}) + resources = vr.create('nodes_network', 'templates/nodes_network', {"count": nodes_count}) nodes_sdn = [x for x in resources if x.name.startswith('node')] r = {} diff --git a/examples/provisioning/provision.py b/examples/provisioning/provision.py index f9b6bd2a..14c88c68 100755 --- a/examples/provisioning/provision.py +++ b/examples/provisioning/provision.py @@ -40,7 +40,7 @@ requests.post(bareon_sync) nodes_list = requests.get(discovery_service).json() # Create slave node resources -node_resources = vr.create('nodes', 'templates/not_provisioned_nodes.yaml', +node_resources = vr.create('nodes', 'templates/not_provisioned_nodes', {'nodes': nodes_list}) # Get master node diff --git a/examples/riak/riak_cluster.yaml b/examples/riak/riak_cluster.yaml index 98143d1f..277ab228 100644 --- a/examples/riak/riak_cluster.yaml +++ b/examples/riak/riak_cluster.yaml @@ -30,21 +30,21 @@ resources: riaks: ['riak_service1', 'riak_service2', 'riak_service3'] - id: haproxy1 - from: templates/haproxy.yaml + from: templates/haproxy values: node: {{nodes[0]}} service_configs: ['haproxy_riak_config_pb', 'haproxy_riak_config_http'] index: 1 - id: haproxy2 - from: templates/haproxy.yaml + from: templates/haproxy values: node: {{nodes[1]}} service_configs: ['haproxy_riak_config_pb', 'haproxy_riak_config_http'] index: 2 - id: haproxy3 - from: templates/haproxy.yaml + from: templates/haproxy values: node: {{nodes[2]}} service_configs: ['haproxy_riak_config_pb', 'haproxy_riak_config_http'] diff --git a/examples/riak/riaks-template.py b/examples/riak/riaks-template.py index 13e49ed6..2c75d869 100755 --- a/examples/riak/riaks-template.py +++ b/examples/riak/riaks-template.py @@ -15,7 +15,7 @@ from solar.dblayer.model import ModelMeta def setup_riak(): ModelMeta.remove_all() - nodes = template.nodes_from('templates/riak_nodes.yaml') + nodes = template.nodes_from('templates/riak_nodes') riak_services = nodes.on_each( 'resources/riak_node', diff --git a/examples/riak/riaks.py b/examples/riak/riaks.py index 4c43d1eb..afe3c527 100755 --- a/examples/riak/riaks.py +++ b/examples/riak/riaks.py @@ -31,7 +31,7 @@ from solar.dblayer.solar_models import Resource def setup_riak(): ModelMeta.remove_all() - resources = vr.create('nodes', 'templates/nodes.yaml', {'count': 3}) + resources = vr.create('nodes', 'templates/nodes', {'count': 3}) 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 diff --git a/examples/riak/riaks_big.py b/examples/riak/riaks_big.py index e084fbca..9525f3d7 100755 --- a/examples/riak/riaks_big.py +++ b/examples/riak/riaks_big.py @@ -28,7 +28,7 @@ def setup_riak(nodes_num=None, hosts_mapping=False): nodes_num = NODES db.clear() - resources = vr.create('nodes', 'templates/nodes.yaml', {'count': nodes_num}) + resources = vr.create('nodes', 'templates/nodes', {'count': nodes_num}) nodes = [x for x in resources if x.name.startswith('node')] hosts_services = [x for x in resources if x.name.startswith('hosts_file')] diff --git a/templates/controller/1.0.0/controller.yaml b/templates/controller/1.0.0/controller.yaml index b2a908e3..5d34bc61 100644 --- a/templates/controller/1.0.0/controller.yaml +++ b/templates/controller/1.0.0/controller.yaml @@ -19,7 +19,7 @@ resources: ssh_key: '#{ssh_key}#' - id: keystone_base - from: templates/keystone_base.yaml + from: templates/keystone_base values: login_user: root login_password: 'mariadb_service::root_password' @@ -33,7 +33,7 @@ resources: ssh_key: '#{ssh_key}#' - id: keystone_api_1 - from: templates/keystone_api.yaml + from: templates/keystone_api values: idx: 1 db_password: 'keystone_db_user::user_password' @@ -49,7 +49,7 @@ resources: ssh_key: '#{ssh_key}#' - id: openstack_base - from: templates/openstack_base.yaml + from: templates/openstack_base values: ip: '#{ip}#' ssh_user: '#{ssh_user}#' diff --git a/templates/glance/1.0.0/glance.yaml b/templates/glance/1.0.0/glance.yaml index 7d28bbec..475b20a4 100644 --- a/templates/glance/1.0.0/glance.yaml +++ b/templates/glance/1.0.0/glance.yaml @@ -2,7 +2,7 @@ id: glance_#{idx}# resources: - id: glance_base_#{ idx }# - from: templates/glance_db.yaml + from: templates/glance_db values: idx: '#{ idx }#'