-
Notifications
You must be signed in to change notification settings - Fork 583
MODULES-11309 : convert a string to a resource #1233
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
str2resource is a functionthat may have no external impact to Forge modules. This module is declared in 318 of 579 indexed public
|
I'm not sure what to do about the windows test failure.... |
I was trying to get the test timeout to go away and added an example of how I'd use this. There are dozens of modules on the forge that have various versions of this pattern. In theory having this in stdlib would help unify the community and reduce the maintenance burden on various folks. |
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'm questioning the usefulness of this. Do you have examples where it makes sense?
Also for ordering you can use a collector. I think this should work, whether the file exists or not.
Package['mypackage'] -> File <| title == '/foo' |>
This was inspired in part by https://forge.puppet.com/modules/jake/resource_tree and https://forge.puppet.com/modules/jaydub/resource_factory, however, those aren't up to date. I've also been using a few elements from https://github.com/voxpupuli/puppet-system (some one off sysctl and package resources). Most of the modules I work with have a hash argument to create their defined resources, but puppet itself doesn't have a way pass in "make these trivial things" from the builtin resources. My primary usage would be something like this - but not this many on one host (using the class I've demo'd here which I can drop if requested): stdlib::manage::create_resources:
file:
/etc/krb5.conf:
source: https://authentication.fnal.gov/krb5conf/Linux/krb5.conf
package:
avahi:
ensure: absent
archive:
FermiCerts:
path: /tmp/._certs.zip
source: https://authentication.fnal.gov/certs/FERMI_CA_Certs-PEM.zip
extract: true
extract_path: /etc/pki/ca-trust/source/anchors
creates: /etc/pki/ca-trust/source/anchors/Fermilab_Root_CA.pem
require: Package[unzip] I see the biggest gains in this mostly around I'd like to do something like: stdlib::manage::create_resources:
file:
/etc/motd.d/patch_group:
content: "\nThis system is part of patch group: %{::patching_as_code::patch_group}" My existing motd module doesn't have a great way of using the data I can extract from My hierarchy:
<snip>
- name: 'Common Defaults'
glob: 'common/*.yaml' Or put the one-off declaration actually in |
I'm not sure how I'd deference the variables to get the |
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.
@jcpunk This look's good to me so I'm gonna go ahead and merge.
Thank you for putting the work in to get it up and over the line :)
I'll need a bit of help loading the resources into the catalog for the tests, but in theory that should be all that is required.