-
Notifications
You must be signed in to change notification settings - Fork 2.2k
(PUP-10139) Add find_template function #7840
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Ben, that adds the missing find
function to puppet core...
# | ||
# This function can also accept: | ||
# | ||
# * An absolute String path, which will check for the existence of a template from anywhere on disk. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be good to clarify where on disk this is searched. The master or the agent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
CLA signed by all contributors. |
jenkins please test this on centos6-64 |
@puppetlabs/tech-pubs This is a new function with all new description, would someone mind taking a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, overall! I've suggested a few changes for spelling/typos and style.
# will search for the file `<MODULES DIRECTORY>/mymod/templates/secret.conf.epp`.) | ||
# | ||
# The primary use case is for agent-side template rendering with late-bound variables | ||
# resolved, e.g. from secret stores inaccessable to the master, such as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace "e.g." with "such as"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also "inaccessable" should be "inaccessible"
# Finds an existing template from a module and returns its path. | ||
# | ||
# The argument to this function should be a String as a `<MODULE NAME>/<TEMPLATE>` | ||
# reference, which will search for `<TEMPLATE>` relative to a module's `templates` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace "which will search" with "which searches"
@@ -0,0 +1,63 @@ | |||
# Finds an existing template from a module and returns its path. | |||
# | |||
# The argument to this function should be a String as a `<MODULE NAME>/<TEMPLATE>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change "The argument to this function should be" to "This function accepts an argument that is"
# The primary use case is for agent-side template rendering with late-bound variables | ||
# resolved, e.g. from secret stores inaccessable to the master, such as | ||
# | ||
# ```` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra backtick
# | ||
# This function can also accept: | ||
# | ||
# * An absolute String path, which will check for the existence of a template from anywhere on disk. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change "which will check" to "which checks"
# This function can also accept: | ||
# | ||
# * An absolute String path, which will check for the existence of a template from anywhere on disk. | ||
# * Multiple String arguments, which will return the path of the **first** template |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change "which will return" to "which returns"
# | ||
# * An absolute String path, which will check for the existence of a template from anywhere on disk. | ||
# * Multiple String arguments, which will return the path of the **first** template | ||
# found, skipping non existing files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"non existing" should be "nonexistent"
# * An absolute String path, which will check for the existence of a template from anywhere on disk. | ||
# * Multiple String arguments, which will return the path of the **first** template | ||
# found, skipping non existing files. | ||
# * An array of string paths, which will return the path of the **first** template |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change "which will return" to "which returns"
# * Multiple String arguments, which will return the path of the **first** template | ||
# found, skipping non existing files. | ||
# * An array of string paths, which will return the path of the **first** template | ||
# found from the given paths in the array, skipping non existing files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"non existing" should be "nonexistent"
# * An array of string paths, which will return the path of the **first** template | ||
# found from the given paths in the array, skipping non existing files. | ||
# | ||
# The function returns `undef` if none of the given paths were found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing period at the end of the sentence.
Thanks @jbondpdx. I'll file a separate PR to port these back to the |
Thank you so much for working on this, Ben!
…On Mon, Nov 25, 2019 at 10:56 AM Ben Ford ***@***.***> wrote:
Thanks @jbondpdx <https://github.com/jbondpdx>. I'll file a separate PR
to port these back to the find_file() function which was the original
source.
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub
<#7840?email_source=notifications&email_token=AB4PMACWYVA3BSVTHIEBAZTQVQNUZA5CNFSM4JNAQ2OKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFDN2SQ#issuecomment-558292298>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB4PMAFANI4F4L4365QSVYDQVQNUZANCNFSM4JNAQ2OA>
.
--
Jean Bond
she/her
Manager, Technical Publications
Puppet
|
This makes it easier users to render templates on the agent, meaning that they can use secret values resolved by deferred functions directly with e.g. Vault. That means that the master no longer needs keys to the kingdom.
After @jbondpdx approval this is probably good to merge 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This makes it easier users to render templates on the agent, meaning that
they can use secret values resolved by deferred functions directly with
e.g. Vault. That means that the master no longer needs keys to the kingdom.