-
-
Notifications
You must be signed in to change notification settings - Fork 273
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
replace create_resources with resource types #874
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.
Love the idea of getting rid of create_resources, but I think the replacement pattern used here is more complicated than it needs to be.
$_manage_package = pick($manage_package, $::collectd::manage_package) | ||
$databases_defaults = { 'ensure' => $ensure } | ||
$queries_defaults = { 'ensure' => $ensure } | ||
$writers_defaults = { 'ensure' => $ensure } |
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.
Why create all these identical hashes?
@bastelfreak Did you not like #874 (comment) ?
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.
looool i thought this too. It's one way of separating defaults for each resource
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.
collectd::plugin::postgresql::writer { $resource:
* => { 'ensure' => $ensure } + $attributes,
}
better?
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.
With create_resources
we had to pass a hash for the defaults (although it didn't strictly need to be assigned to a variable first).
Since we just have a single default property (ensure
), putting it directly in the resource declaration is probably cleaner??
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.
collectd::plugin::postgresql::writer { $resource: * => { 'ensure' => $ensure } + $attributes, }
better?
No need to merge hashes. Just...
collectd::plugin::postgresql::writer { $resource:
ensure => $ensure,
* => $attributes,
}
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.
That depends on $attributes
not containing an override for ensure
though. (which might be a perfectly reasonable assumption?)
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.
they do contain them....
https://github.com/voxpupuli/puppet-collectd/blob/master/manifests/plugin/postgresql/writer.pp#L3
default is 'present' anyhow
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.
Actually... I don't think that is a safe assumption.
* => { 'ensure' => $ensure } + $attributes,
works for me.
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.
ok. well, we still get one thing... replacement of create_resources :)
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.
@alexjfisher I'm fine with this. What do you think?
Since MR voxpupuli#874 the processmatch type is not working. For instance a configuration of ```puppet collectd::plugin::processes::processmatch{'eosd': collect_file_descriptor => true, collect_memory_maps => true, collect_context_switch => false, regex => 'eosd .*$', } ``` should create a file (on centos) `/etc/collectd.d/processes-config.conf` containing ```apache <Plugin processes> <ProcessMatch "eosd" "eosd .*$"> CollectContextSwitch false CollectFileDescriptor true CollectMemoryMaps true </ProcessMatch> </Plugin> ``` but alas no configuration is created anywhere, the file itself is not even created.
Pull Request (PR) description
Replace create_resources with resource types
This Pull Request (PR) fixes the following issues
Fixes #716 (Replace create_resources() calls)