lelutin / puppet-spamassassin

Install and configure spamassassin either as a service (through spamd) or for use with applications like amavisd. This is a fork of https://bitbucket.org/wyrie/puppet-spamassassin
Other
2 stars 9 forks source link

When using spamd_sql_config, user_scores_sql_custom_query is required #5

Closed kienanstewart closed 4 years ago

kienanstewart commented 4 years ago

When using the spamassassin class in the following manner:

class { 'spamassassin':
  spamd_sql_config         => true,
  user_scores_dsn          => 'DBI:mysql:spamassassin:mysql.example.com'
  user_scores_sql_username => 'spamassassin',
  user_scores_sql_password => 'xxx'
}

The manifest is will fail with the following error: Error while evaluating a Function Call, spamd_sql_config is enabled but one or more of $user_scores_* not set (file: /etc/puppet/code/environments/production/modules/spamassassin/manifests/init.pp, line: 576, column: 5)

If I understand the documentation correctly user_scores_sql_custom_query has a default value, so it seems that the parameter shouldn't be required by the puppet class, or should default to value proposed by upstream. C.f. https://spamassassin.apache.org/full/3.4.x/doc/Mail_SpamAssassin_Conf.html

Do either of those options seem reasonable?

lelutin commented 4 years ago

ah yes thanks for figuring this out! I would tend to think that the former would be more resilient to SA changing the default value, but would be a bit more complex to put together. however it doesn't seem overly complex, so if you're up to it I'd probably lean towards this option (I haven't inspected the code to confirm my declaration that it should be feasible.. so ymmv)

kienanstewart commented 4 years ago

Well, I didn't see that somebody else already fixed this! https://github.com/lelutin/puppet-spamassassin/commit/93aab08482969f14bf710cde19bae0ba8de7bad0