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

Instanciating default fact to false is not necessarily a good idea #251

Open
dje4om opened this issue Apr 29, 2020 · 0 comments
Open

Instanciating default fact to false is not necessarily a good idea #251

dje4om opened this issue Apr 29, 2020 · 0 comments

Comments

@dje4om
Copy link

dje4om commented Apr 29, 2020

filebeat_version.nil? ? false : %r{^filebeat version ([^\s]+)?}.match(filebeat_version)[1]

Hi,

We expect to have a string to keep consistency on the data instead of a boolean when no filebeat binary is detected.
We parse lots of puppet fact data, and this is a type exception, for a node we have a string version, and for another a false bool.

It seems to be used in code, it should be better to have a real boolean fact to check if filebeat exist

manifests/input.pp:58:  if 'filebeat_version' in $facts and $facts['filebeat_version'] != false {
manifests/input.pp:59:    $skip_validation = versioncmp($facts['filebeat_version'], $filebeat::major_version) ? {
manifests/input.pp:113:        default => $facts['filebeat_version'] ? {
manifests/config.pp:87:  if 'filebeat_version' in $facts and $facts['filebeat_version'] != false {
manifests/config.pp:88:    $skip_validation = versioncmp($facts['filebeat_version'], $filebeat::major_version) ? {
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