Commit 5962ca5c authored by Saurabh's avatar Saurabh Committed by Julien Muchembled

NEO: new 'sla-dict' instanciation parameter, working like for ERP5

parent ef1359e6
...@@ -2,10 +2,14 @@ ...@@ -2,10 +2,14 @@
{% macro section(name) %}{% do part_list.append(name) %}{{ name }}{% endmacro -%} {% macro section(name) %}{% do part_list.append(name) %}{{ name }}{% endmacro -%}
{% set part_list = [] -%} {% set part_list = [] -%}
{% set section_id_list = [] -%} {% set section_id_list = [] -%}
{% set sla_dict = {} -%}
{% for sla, ref_list in slapparameter_dict.get('sla-dict', {}).iteritems() -%}
{% do sla_dict.update(dict.fromkeys(ref_list, sla)) -%}
{% endfor -%}
[request-common] [request-common]
recipe = slapos.cookbook:request.serialised recipe = slapos.cookbook:request.serialised
software-url = ${slap-connection:software-release-url} software-url = ${slap-connection:software-release-url}
sla-computer_guid = ${slap-connection:computer-id}
server-url = ${slap-connection:server-url} server-url = ${slap-connection:server-url}
key-file = ${slap-connection:key-file} key-file = ${slap-connection:key-file}
cert-file = ${slap-connection:cert-file} cert-file = ${slap-connection:cert-file}
...@@ -19,6 +23,16 @@ config-upstream-cluster = {{ dumps(slapparameter_dict.get('upstream-cluster', '' ...@@ -19,6 +23,16 @@ config-upstream-cluster = {{ dumps(slapparameter_dict.get('upstream-cluster', ''
config-upstream-masters = {{ dumps(slapparameter_dict.get('upstream-masters', '')) }} config-upstream-masters = {{ dumps(slapparameter_dict.get('upstream-masters', '')) }}
software-type = neo software-type = neo
{% macro sla(name) -%}
{% if name in sla_dict -%}
{% for k, (v,) in urlparse.parse_qs(sla_dict.pop(name), strict_parsing=1).iteritems() -%}
sla-{{ k }} = {{ v }}
{% endfor -%}
{% else -%}
sla-computer_guid = ${slap-connection:computer-id}
{% endif -%}
{% endmacro -%}
[publish] [publish]
recipe = slapos.cookbook:publish.serialised recipe = slapos.cookbook:publish.serialised
masters = ${node-0-final:connection-masters} masters = ${node-0-final:connection-masters}
...@@ -35,6 +49,7 @@ name = {{ section_id }} ...@@ -35,6 +49,7 @@ name = {{ section_id }}
{% for k, v in node.iteritems() -%} {% for k, v in node.iteritems() -%}
config-{{ k }} = {{ dumps(v) }} config-{{ k }} = {{ dumps(v) }}
{% endfor -%} {% endfor -%}
{{ sla(section_id) }}
[{{ section_id }}] [{{ section_id }}]
<= request-common <= request-common
......
...@@ -26,6 +26,8 @@ context = ...@@ -26,6 +26,8 @@ context =
[neo-cluster] [neo-cluster]
<= jinja2-template-base <= jinja2-template-base
template = {{ cluster }} template = {{ cluster }}
extra-context =
import urlparse urlparse
[neo-admin] [neo-admin]
<= jinja2-template-base <= jinja2-template-base
......
...@@ -41,7 +41,7 @@ scripts = ...@@ -41,7 +41,7 @@ scripts =
[cluster] [cluster]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:_buildout_section_name_}.cfg.in url = ${:_profile_base_location_}/${:_buildout_section_name_}.cfg.in
md5sum = 5e422ddd4ecfe85daa3e151cde261c75 md5sum = 02d7d576ef30f7d440b703d6fc57866a
# XXX: following mode should be the default # XXX: following mode should be the default
mode = 644 mode = 644
...@@ -65,7 +65,7 @@ md5sum = febd3ed58043ce1367b86cf6e4e69700 ...@@ -65,7 +65,7 @@ md5sum = febd3ed58043ce1367b86cf6e4e69700
[template] [template]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/instance.cfg.in template = ${:_profile_base_location_}/instance.cfg.in
md5sum = 6101da4361793eddde62b6be1639c25e md5sum = e0917a4a4aa102d6fa4274530d56959e
# XXX: "template.cfg" is hardcoded in instanciation recipe # XXX: "template.cfg" is hardcoded in instanciation recipe
rendered = ${buildout:directory}/template.cfg rendered = ${buildout:directory}/template.cfg
context = context =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment