-
Notifications
You must be signed in to change notification settings - Fork 216
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
Add support for epp templates #300
base: master
Are you sure you want to change the base?
Conversation
@patemery Please rebase this MR, fix issues and squash commits |
manifests/conf.pp
Outdated
@@ -40,6 +40,7 @@ | |||
$content = undef, | |||
$source = undef, | |||
$template = undef, | |||
$template_epp = undef, |
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.
Add a type:
Optional[Hash[String[1], Hash]] $template = undef,
This will also make validation easier.
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.
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.
Try it with the following, please.
Optional[Struct[{ filename => String, params => Hash }]]
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.
btw: it would be good to have some tests for this functionality
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.
I tried your new type and it worked perfectly. Thanks for that. I definitely would not have ever come up with that.
Wow. I don't have a lot of git experience. It took me about 3 hours to get this all cleaned up. I think I have it the way you wanted it. Thank you so much for considering my enhancement. Let me know if I am still missing anything |
@patemery I've just merged a PR, which adds data types to all parameters in |
@saz I merged all of your latest commits and tried your latest type suggestion. It worked great. Thank you for that. I would have never come up with that. I looked at the existing tests. I'm sad to admit I've never written any rspec tests. I think I can create a few following the existing code as examples. Can you tell me how to execute the tests on my local system? I downloaded and installed pdk and I tried doing |
Add the capability to use epp templates in hiera data to create sudoers.d files. There are two solutions for this. If the epp template is a simple template, then it can simply be used with the
template
meta-parameter without any other changes as in the following example.If the epp template is more complex and requires input parameters, there is a new meta-parameter
template_epp
. This meta-parameter requires two input parameters; filename (string) and params (hash). There are examples of this given in the README.Additionally, I've added two new epp templates that allow for some more elaborate sudoers.d allocations.