voxpupuli/puppet-fail2ban

You cannot specify more than one of content, source, target

Opened this issue · 3 comments

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 6
  • Ruby:
  • Distribution:
  • Module version:

How to reproduce (e.g Puppet code you use)

class { 'fail2ban':
    package_ensure => 'latest',
    config_file_source => "puppet:///modules/base_sys/jail.local",
  }

What are you seeing

Error: Failed to apply catalog: Validation of File[fail2ban.conf] failed: You cannot specify more than one of content, source, target (file: /etc/puppetlabs/code/environments/production/modules/fail2ban/manifests/config.pp, line: 17)

What behaviour did you expect instead

Should work

Output log

Any additional information you'd like to impart

these parameters are more or less directly passed to the file type, and that's where the restrictions are

what behaviour would you expect of you specify content and source?
how should it be merged?

Sorry, my bad, I didn't paste the whole code:

  class { 'fail2ban':
    package_ensure => 'latest',
    config_file_source => "puppet:///modules/base_sys/jail.local",
  }

This is everything to trigger the error. In the end I tracked down this is the cause: manifests/init.pp:51

$config_file_content = extlib::default_content($config_file_string, $config_file_template)

for some reason this returns something that's not undef, and the only workaround i found for now was either:

  if $config_file_string and $config_file_template {
    $config_file_content = extlib::default_content($config_file_string, $config_file_template)
  }

or better yet, just copy the config file without relying on the module, with file

same here
fail2ban::config_file_source: "puppet:///modules/fail2ban/etc/fail2ban/jail.conf"

Validation of File[fail2ban.conf] failed: You cannot specify more than one of content, source, target (file: /etc/puppetlabs/code/environments/fail/modules/fail2ban/manifests/config.pp, line: 16)