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

versioncmp in params.pp #299

Closed
ralfbosz opened this issue Apr 12, 2022 · 4 comments · Fixed by #306
Closed

versioncmp in params.pp #299

ralfbosz opened this issue Apr 12, 2022 · 4 comments · Fixed by #306

Comments

@ralfbosz
Copy link
Contributor

ralfbosz commented Apr 12, 2022

In the latest version (4.11.1) there is a bug in params.pp for fresh-installs. When 'filebeat' is not installed yet, the fact 'filebeat-version' gives a 'false' which Puppet sees as Boolean which causes an error:

Error: Evaluation Error: Error while evaluating a Function Call, 'versioncmp' parameter 'a' expects a String value, got Boolean (file: /etc/puppetlabs/code/modules/filebeat/manifests/params.pp, line: 172, column: 6)

Version 4.11.0 does not have this error, the fault is in the params.pp:

if versioncmp($facts['filebeat_version'], '7.16') > 0 {
$default_input_type = 'filestream'
} else {
$default_input_type = 'log'
}

@sclaggett
Copy link

I just ran into this bug as well. My solution was to change the first line:

  if (!$facts['filebeat_version']) or (versioncmp($facts['filebeat_version'], '7.16') > 0) {
    $default_input_type = 'filestream'
  } else {
    $default_input_type = 'log'
  }

That works for me because I know the version of filebeat I'm using is greater than 7.16, but it certainly isn't the correct fix.

@sclaggett
Copy link

The same bug also exists in input.pp, line 57.

@ralfbosz
Copy link
Contributor Author

The same bug also exists in input.pp, line 57.

It is there but when it hits that a version of FileBeat Will be present.

@sclaggett
Copy link

It is there but when it hits that a version of FileBeat Will be present.

Perhaps in theory, but somehow I encountered the bug there in practice.

qalick pushed a commit to qalick/puppet-filebeat that referenced this issue Jun 22, 2022
juokelis pushed a commit to juokelis/puppet-filebeat that referenced this issue Jul 14, 2022
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

Successfully merging a pull request may close this issue.

2 participants