Skip to content

Commit f3f752c

Browse files
authored
Merge pull request #56 from salt-formulas/develop
Merge develop branch to master
2 parents a3f207e + 286ed46 commit f3f752c

23 files changed

+542
-192
lines changed

README-extentions.rst

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,55 @@ Referenced lists or dicts can now be overriden by None or empty type of dict, li
124124
three: ${one}
125125
126126
127+
Constant Parameters
128+
--------------------------
129+
130+
Parameters can be labeled as constant by using the prefix ``=``
131+
132+
.. code-block:: yaml
133+
134+
parameters:
135+
=one: 1
136+
137+
If in the normal parameter merging a constant parameter would be changed then depending
138+
on the setting of ``strict_constant_parameters`` either an exception is raised (``strict_constant_parameters`` true)
139+
or the parameter is left unchanged and no notification or error is given (``strict_constant_parameters`` false)
140+
141+
For example with:
142+
143+
.. code-block:: yaml
144+
145+
# nodes/node1.yml
146+
classes:
147+
- first
148+
- second
149+
150+
# classes/first.yml
151+
parameters:
152+
=one: 1
153+
154+
# classes/second.yml
155+
parameters:
156+
one: 2
157+
158+
``reclass.py --nodeinfo node1`` then gives an ''Attempt to change constant value'' error if ``strict_constant_parameters``
159+
is true or gives:
160+
161+
.. code-block:: yaml
162+
163+
parameters:
164+
alpha:
165+
one: 1
166+
167+
if ``strict_constant_parameters`` is false
168+
169+
Default value for ``strict_constant_parameters`` is True
170+
171+
.. code-block:: yaml
172+
173+
strict_constant_parameters: True
174+
175+
127176
Nested References
128177
-----------------
129178

@@ -155,11 +204,12 @@ the reference ``${beta:a}`` to the value 99.
155204

156205

157206
Ignore overwritten missing references
158-
-------------------------
207+
-------------------------------------
159208

160209
Given the following classes:
161210

162211
.. code-block:: yaml
212+
163213
# node1.yml
164214
classes:
165215
- class1
@@ -197,6 +247,7 @@ Print summary of missed references
197247
Instead of failing on the first undefinded reference error all missing reference errors are printed at once.
198248

199249
.. code-block:: yaml
250+
200251
reclass --nodeinfo mynode
201252
-> dontpanic
202253
Cannot resolve ${_param:kkk}, at mkkek3:tree:to:fail, in yaml_fs:///test/classes/third.yml
@@ -237,6 +288,7 @@ Assuming following class setup:
237288
Classes:
238289

239290
.. code-block:: yaml
291+
240292
#/etc/reclass/classes/global.yml
241293
parameters:
242294
_class:

reclass/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def _get_inventory(self, all_envs, environment, queries):
188188
node.interpolate_single_export(q)
189189
except InterpolationError as e:
190190
e.nodename = nodename
191-
raise InvQueryError(q.contents(), e, context=p, uri=q.uri())
191+
raise InvQueryError(q.contents(), e, context=p, uri=q.uri)
192192
inventory[nodename] = node.exports.as_dict()
193193
return inventory
194194

reclass/datatypes/entity.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def merge(self, other):
8383
self._exports.merge(other._exports)
8484
self._name = other.name
8585
self._uri = other.uri
86+
self._parameters._uri = other.uri
8687
if other.environment != None:
8788
self._environment = other.environment
8889

reclass/datatypes/exports.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def _interpolate_render_from_external(self, context, path, value):
9292
e.context = path
9393
raise
9494
if isinstance(new, dict):
95-
self._render_simple_dict(new, path)
95+
new = self._render_simple_dict(new, path)
9696
elif isinstance(new, list):
97-
self._render_simple_list(new, path)
97+
new = self._render_simple_list(new, path)
9898
return new

0 commit comments

Comments
 (0)