Sha256: 231d46bd6d1286d0690979e95be84d3d8f4cb915d87411979e4d46dc3d5ede9b

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

# Verify that -p loads external and custom facts from puppet locations
test_name "C14783: facter -p loads facts from puppet" do
  tag 'risk:high'

  confine :to, :platform => /Skipped/

  agents.each do |agent|
    external_dir = agent.puppet['pluginfactdest']
    external_file = File.join(external_dir, "external.txt")
    custom_dir = File.join(agent.puppet['plugindest'], "facter")
    custom_file = "#{custom_dir}/custom.rb"

    teardown do
      on agent, "rm -f '#{external_file}' '#{custom_file}'"
    end

    step "Agent #{agent}: create external fact" do
      on agent, "mkdir -p '#{external_dir}'"
      create_remote_file(agent, external_file, "external=external")
    end

    step "Agent #{agent}: create custom fact" do
      on agent, "mkdir -p '#{custom_dir}'"
      create_remote_file(agent, custom_file, "Facter.add(:custom) { setcode { 'custom' } }")
    end

    step "Agent #{agent}: verify facts" do
      on(agent, facter("-p external")) do |facter_output|
        assert_equal("external", facter_output.stdout.chomp)
      end

      on(agent, facter("-p custom")) do |facter_output|
        assert_equal("custom", facter_output.stdout.chomp)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
facter-4.0.29 acceptance/tests/options/puppet_facts.rb
facter-4.0.28 acceptance/tests/options/puppet_facts.rb