File: empty_string_in_blocklist.rb

package info (click to toggle)
facter 4.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,276 kB
  • sloc: ruby: 64,130; sh: 48; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 1,106 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# This tests is intended to verify that an empty string in blocklist will not block all facts
test_name "empty string in blocklist does not block facts" do
  tag 'risk:high'

  require 'facter/acceptance/user_fact_utils'
  extend Facter::Acceptance::UserFactUtils

  agents.each do |agent|
    # default facter.conf
    facter_conf_default_dir = get_default_fact_dir(agent['platform'], on(agent, facter('kernelmajversion')).stdout.chomp.to_f)
    facter_conf_default_path = File.join(facter_conf_default_dir, "facter.conf")

    teardown do
      agent.rm_rf(facter_conf_default_dir)
    end

    # create the directories
    agent.mkdir_p(facter_conf_default_dir)

    step "Agent #{agent}: create config file" do
      create_remote_file(agent, facter_conf_default_path, <<-FILE)
      cli : { debug : true }
      facts : { blocklist : [ "" ] }
      FILE
    end

    step "no facts should be blocked is specified" do
      on(agent, facter) do |facter_output|
        refute_match(/blocking collection of .+ facts/, facter_output.stderr, "Expected no facts to be blocked")
      end
    end
  end
end