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

RSpec failing with puppet 8.10.0 #348

Open
r003k opened this issue Feb 12, 2025 · 0 comments
Open

RSpec failing with puppet 8.10.0 #348

r003k opened this issue Feb 12, 2025 · 0 comments

Comments

@r003k
Copy link

r003k commented Feb 12, 2025

Hello,

I'm currently running rspec unit tests with puppet 8.10.0 and I get an error when calling filebeat class:

puppet

    class { 'filebeat':
      major_version  => '7',
      package_ensure => 'latest',
      manage_repo    => $manage_repo,
      beat_name      => $facts['networking']['fqdn'],
      fields         => {
        customer    => $ccode,
        environment => $environment,
      },
      outputs        => {
        logstash => {
          hosts   => $hosts,
          ttl     => 300,
          timeout => 300,
        },
      },
      logging        => {
        level     => 'warning',
        to_syslog => true,
        metrics   => { enabled => false, },
      },
      monitoring     => {
        enabled       => true,
        cluster_uuid  =>'6k1fejSOQKO7oALvS-h9GA', # uuid sas-cluster
        elasticsearch => {
          sniffing => false,
          hosts    => $monhosts,
        },
      },
      purge_conf_dir => $filebeat_purge_conf_dir,
    }

error

Puppet::PreformattedError:
   Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, Failed to parse template filebeat/input.yml.erb:
    Filepath: /home/rook/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/puppet-8.10.0/lib/puppet/util/package.rb Line: 12
    Detail: undefined method `scan' for nil:NilClass
      (file: /home/rook/git-repos/puppet-profiles/spec/fixtures/modules/filebeat/manifests/input.pp, line: 91, column: 25)

The error points to this resource declaration in filebeat/input.pp:

      file { "filebeat-${name}":
        ensure       => $ensure,
        path         => "${filebeat::config_dir}/${name}.yml",
        owner        => 'root',
        group        => '0',
        mode         => $filebeat::config_file_mode,
        content      => template("${module_name}/${input_template}"),
        validate_cmd => $validate_cmd,
        notify       => Service['filebeat'],
        require      => File['filebeat.yml'],
      }
    }

more specifically:

content      => template("${module_name}/${input_template}"),

The unit test works on puppet 7 but now breaks on puppet 8, what am I missing ?

Here's the declaration for filebeat module in .fixtures.yml:

    filebeat:
      repo: 'pcfens-filebeat'
      ref: '4.14.0'
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

1 participant