Reputation: 420
I'm using the postgresql puppetlabs module in my manifest. They have one parameter called $service_manage
set to true
by default in the params.pp
file, so it looks like
class postgresql::params inherits postgresql::globals {
$service_manage = true
if $service_manage {
# do something
}
}
What exactly I want is that I want to set the variable $service_manage
's value as false
, so that the if
block doesn't apply to my manifest. I'm using it like this,
class mypostgres::config {
class { 'postgresql::params' : service_manage => 'false' }
}
But it's failing with this error,
SERVER: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Postgresql::Params] is already declared; cannot redeclare at /etc/puppet/modules/mypostgres/config.pp:4
I've also tried this
class postgresql::params { $service_manage = "false" }
but this also doesn't work.
Upvotes: 2
Views: 3153
Reputation: 28739
You are supposed to directly declare/include the class using the parameter, and not attempt to indirectly manipulate the params
class. That class is being inherited in this module for defaults and logic. In fact, note: https://github.com/puppetlabs/puppetlabs-postgresql/blob/master/manifests/params.pp#L1
The actual class inheriting that parameter is postgresql::server
. Therefore, when you declare that class you want to override the parameter like this:
class { 'postgresql::server': service_manage => false }
and it will work correctly for you.
It is also worth noting that the if
block of code inside params.pp
for $service_manage
does not actually exist, and should not exist if that design pattern is used by best practices.
Upvotes: 2