voxpupuli / puppet-fail2ban

This module installs, configures and manages the Fail2ban service.
Apache License 2.0
31 stars 106 forks source link

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

Open mcindea opened 4 years ago

mcindea commented 4 years ago

Affected Puppet, Ruby, OS and module versions/distributions

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

igalic commented 4 years ago

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?

mcindea commented 4 years ago

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

mburlic commented 7 months ago

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)