puppet-filebeat
puppet-filebeat copied to clipboard
Instanciating default fact to false is not necessarily a good idea
https://github.com/pcfens/puppet-filebeat/blob/4099b2f7e716e2bb9d1f2394900a865122e6acc9/lib/facter/filebeat_version.rb#L25
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) ? {