<commit_before>require 'facter'

Facter.add('packetbeat_version') do
  confine :kernel => 'Linux' # rubocop:disable Style/HashSyntax
  setcode do
    packetbeat_version = Facter::Util::Resolution.exec(
      '/usr/share/packetbeat/bin/packetbeat -version',
    )

    %r{^packetbeat version ([0-9.]+)}.match(packetbeat_version)[1]
  end
end
<commit_msg>fixed the packetbeat_version facter: no errors if the package is not installed<commit_after>require 'facter'

Facter.add('packetbeat_version') do
  confine :kernel => 'Linux' # rubocop:disable Style/HashSyntax
  setcode do
    packetbeat_version = Facter::Util::Resolution.exec(
      '/usr/share/packetbeat/bin/packetbeat -version',
    )

    %r{^packetbeat version ([0-9.]+)}.match(packetbeat_version)[1] unless packetbeat_version.nil?
  end
end

{'fraction_non_alphanumeric': 0.13092269326683292, 'fraction_numerical': 0.007481296758104738, 'mean_word_length': 4.776978417266187, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3495827', 'n_tokens_mistral': 271, 'n_tokens_neox': 264, 'n_words': 53}