Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mcindea opened this issue Jun 19, 2020 · 3 comments
Open

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

mcindea opened this issue Jun 19, 2020 · 3 comments

Comments

@mcindea
Copy link

mcindea commented Jun 19, 2020

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

@igalic
Copy link
Contributor

igalic commented Jun 20, 2020

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
Copy link
Author

mcindea commented Jun 20, 2020

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
Copy link

mburlic commented Mar 18, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants