ccin2p3 / puppet-patterndb

Puppet module for handling syslog-ng patterndb
Other
0 stars 3 forks source link

Fix duplicate resource declaration issue #9

Closed smortex closed 5 years ago

smortex commented 5 years ago

According to the documentation of ensure_resource() of stdlib:

If the resource already exists, but does not match the specified parameters, this function attempts to recreate the resource, leading to a duplicate resource definition error.

It happens that the puppet-syslog_ng module does declare the same resource with different (meta-)parameters:

https://github.com/ccin2p3/puppet-syslog_ng/blob/master/manifests/init.pp#L28-L34

As a consequence, the catalog fails to compile:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Duplicate declaration: Package[syslog-ng-core] is already declared at (file: /etc/puppetlabs/code/environments/romain/modules/syslog_ng/manifests/init.pp, line: 28); cannot redeclare (file: /etc/puppetlabs/code/environments/romain/modules/patterndb/manifests/init.pp, line: 23) (file: /etc/puppetlabs/code/environments/romain/modules/patterndb/manifests/init.pp, line: 23, column: 5) on node ns3745003.ip-213-32-0.eu

The ensure_packages() function does not suffer from this, so rely on it instead of ensure_resource().

faxm0dem commented 5 years ago

that's why there is the manage_package parameter, would that suit your needs? I'd like to keep the syslog-ng package management to its minimal form. At one point I'll probably even drop it, and simply require the syslog_ng module instead

smortex commented 5 years ago

Yup, manage_package is surely an option :-)

Depending on ccin2p3/syslog_ng also makes a lot of sense. Feel free to ping me if I can help in this area.