Merge "Update .travis.yml and .kitchen.yml files for parallel testing"
diff --git a/README.rst b/README.rst
index 73cdb83..66883b8 100644
--- a/README.rst
+++ b/README.rst
@@ -41,6 +41,11 @@
.. literalinclude:: tests/pillar/generate_multi.sls
:language: yaml
+Reclass model with multiple node defined and interpolation enabled
+
+.. literalinclude:: tests/pillar/generate_multi_interpolate.sls
+ :language: yaml
+
Reclass storage with simple class mappings
.. literalinclude:: tests/pillar/class_mapping.sls
diff --git a/reclass/files/node.yml b/reclass/files/node.yml
index 9b9c3c9..a916432 100644
--- a/reclass/files/node.yml
+++ b/reclass/files/node.yml
@@ -13,10 +13,14 @@
{%- endif %}
{%- endfor %}
{%- for param_name, param_value in extra_params.iteritems() %}
- {%- if param_value is not string %}
- {{ param_name }}: {{ param_value }}
+ {%- if param_value.value is not string %}
+ {{ param_name }}: {{ param_value.value }}
{%- else %}
- {{ param_name }}: {{ param_value|replace("u'", "'") }}
+ {%- if param_value.interpolate %}
+ {{ param_name }}: {% raw %}'${_param:{% endraw %}{{ param_value.value|replace("u'", "'")|replace("'", "") }}}'
+ {%- else %}
+ {{ param_name }}: {{ param_value.value|replace("u'", "'") }}
+ {%- endif %}
{%- endif %}
{%- endfor %}
{%- endif %}
diff --git a/reclass/map.jinja b/reclass/map.jinja
index 5891a1e..5e3bd19 100644
--- a/reclass/map.jinja
+++ b/reclass/map.jinja
@@ -1,28 +1,20 @@
{%- set storage = salt['grains.filter_by']({
- 'Debian': {
+ 'default': {
'base_dir': '/etc/reclass/base',
- 'pkgs': ['reclass', 'python-reclass'],
+ 'storage_type': 'yaml_fs',
+ 'repeat_replace_symbol': '<<count>>',
+ 'class_mappings': {},
+ 'ignore_class_notfound': False,
+ 'propagate_pillar_data_to_reclass': False,
'data_source': {
'engine': 'local'
},
- 'storage_type': 'yaml_fs',
- 'repeat_replace_symbol': '<<count>>',
'version': '1.4.1',
- 'class_mappings': {},
- 'ignore_class_notfound': False,
- 'propagate_pillar_data_to_reclass': False
+ },
+ 'Debian': {
+ 'pkgs': ['reclass', 'python-reclass'],
},
'RedHat': {
- 'base_dir': '/etc/reclass/base',
'pkgs': ['reclass', 'python-reclass'],
- 'data_source': {
- 'engine': 'local'
- },
- 'storage_type': 'yaml_fs',
- 'repeat_replace_symbol': '<<count>>',
- 'version': '1.4.1',
- 'class_mappings': {},
- 'ignore_class_notfound': False,
- 'propagate_pillar_data_to_reclass': False
},
-}, grain='os_family', merge=salt['pillar.get']('reclass:storage')) %}
+}, grain='os_family', merge=salt['pillar.get']('reclass:storage'), base='default') %}
diff --git a/reclass/storage/node.sls b/reclass/storage/node.sls
index df9bdaa..e3ce328 100644
--- a/reclass/storage/node.sls
+++ b/reclass/storage/node.sls
@@ -12,7 +12,7 @@
{%- for param_name, param in node.repeat.params.iteritems() %}
{%- set param_count = (param.get('start', 1) + i)|string %}
{%- set param_value = param.value|replace(storage.repeat_replace_symbol, param_count.rjust(param.get('digits', 1), '0')) %}
-{%- do extra_params.update({param_name: param_value}) %}
+{%- do extra_params.update({param_name: {'value': param_value, 'interpolate': param.get('interpolate', False)}}) %}
{%- endfor %}
{%- set node_count = (node.repeat.get('start', 1) + i)|string %}
diff --git a/tests/pillar/generate_multi_interpolate.sls b/tests/pillar/generate_multi_interpolate.sls
new file mode 100644
index 0000000..113aff3
--- /dev/null
+++ b/tests/pillar/generate_multi_interpolate.sls
@@ -0,0 +1,23 @@
+reclass:
+ storage:
+ enabled: true
+ repeat_replace_symbol: <<count>>
+ node:
+ service_node01:
+ name: node<<count>>
+ domain: deployment.local
+ classes:
+ - cluster.deployment.service.role
+ repeat:
+ count: 2
+ start: 5
+ digits: 2
+ params:
+ single_address:
+ value: ceph_osd_node<<count>>_address
+ start: 1
+ digits: 2
+ interpolate: true
+ params:
+ salt_master_host: <<salt-master-ip>>
+ linux_system_codename: trusty