Skip to content

RSpec failing with puppet 8.10.0 #348

@rook-swissas

Description

@rook-swissas

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions