Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support pillar merging, generally #64

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

mikemol
Copy link
Contributor

@mikemol mikemol commented Jun 14, 2017

For #60.

Support for pillar merging for Server, ServerActive, UserParameter and LoadModule.

Existing pillar data should be unaffected by implementation.

mikemol added 5 commits June 12, 2017 17:30
The flexjoin() macro simplifies support for mergable and composable
structures. All three of these data structures will result in the string
'a s d f'. The third structure, using dicts, also supports pillar merging.

- 'a s d f'

- [ a, s, d, f]

- { a: ~, s: ~, d: ~, f: ~}
Certain configuration items, such as server andserveractive, are
comma-delimited lists. The ordering is unimportant, so we can use
flexjoin() to join our input data. We can then compose our input data
from merged pillars.
The flexcall() macro permits whole-line merged configuration items by
calling a macro for each key in a dict, or by calling a macro for each
item in a list.

These two inputs are equivalent:

- {a: ~, b: ~, c: ~}

- [a, b, c]

Example usage:

{% call(element) flexcall( mydata ) -%}
Here is an element from input: {{ element }}
{% endcall -%}

Example output:

Here is an element from input: a
Here is an element from input: b
Here is an element from input: c
Support pillar merging of UserParameters via flexcall
Use flexcall to support pillar merging for LoadModule and UserParameter
lines.
@mikemol
Copy link
Contributor Author

mikemol commented Jun 14, 2017

Bah. I bungled the commit message for 86da726. That one adds LoadParameter support.

Verify it's actually a list, so NoneTypes etc can't worm their way in.
@mchugh19
Copy link
Contributor

Rather than complicating the state, pillar merging can also be handled master side. Since UserParameters are already specified as a list, you can just enable the pillar_merge_lists: true setting on your master. The pillars assigned to a host will then already be aggregated.

If you would like more control over the pillar overrides or merges, you can use somehting like pillarstack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants