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

Accept mapped_paths #285

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions templates/hiera.yaml.epp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ hierarchy:
- "<%= $path %>"
<%- } -%>
<% } -%>
<% if $hr['mapped_paths'] { -%>
mapped_paths:
- "<%= $hr['mapped_paths'][0] %>"
- "<%= $hr['mapped_paths'][1] %>"
- "<%= $hr['mapped_paths'][2] %>"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are there three of these instead of iterating over however many might be in the array?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah.. because that's how it works :)

https://puppet.com/docs/puppet/latest/hiera_config_yaml_5.html#specifying_file_paths

"The mapped_paths key must contain three string elements, in the following order:

A scope variable that points to a collection of strings.
The variable name that is mapped to each element of the collection.
A template where that variable can be used in interpolation expressions."

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Garrett, just wondering when do you believe it can be pushed up.

<% } -%>
<% if $hr['glob'] { -%>
glob: "<%= $hr['glob'] -%>"
<% } -%>
Expand Down
1 change: 1 addition & 0 deletions types/hiera5_hierarchy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
name => String,
path => Optional[String],
paths => Optional[Array[String]],
mapped_paths => Optional[Array[String,3,3]],
glob => Optional[String],
globs => Optional[Array[String]],
uri => Optional[String],
Expand Down