|
6 | 6 | describe LegacyFacter::Util::Config do
|
7 | 7 | include PuppetlabsSpec::Files
|
8 | 8 |
|
9 |
| - describe "ENV['HOME'] is unset", unless: LegacyFacter::Util::Root.root? do |
10 |
| - around do |example| |
11 |
| - Facter::Core::Execution.with_env('HOME' => nil) do |
12 |
| - example.run |
13 |
| - end |
14 |
| - end |
15 |
| - |
16 |
| - it 'does not set @external_facts_dirs' do |
17 |
| - LegacyFacter::Util::Config.setup_default_ext_facts_dirs |
18 |
| - expect(LegacyFacter::Util::Config.external_facts_dirs).to be_empty |
19 |
| - end |
20 |
| - end |
21 |
| - |
22 | 9 | describe 'is_windows? function' do
|
23 | 10 | it "detects windows if Ruby RbConfig::CONFIG['host_os'] returns a windows OS" do
|
24 | 11 | host_os = %w[mswin win32 dos mingw cygwin]
|
|
80 | 67 | .to eq [File.join('C:\\Documents', 'PuppetLabs', 'facter', 'facts.d')]
|
81 | 68 | end
|
82 | 69 |
|
83 |
| - it "returns the old and new (AIO) paths under user's home directory when not root" do |
| 70 | + it "returns the old and new (AIO) paths under user's home directory when not root on windows 2008" do |
84 | 71 | allow(LegacyFacter::Util::Root).to receive(:root?).and_return(false)
|
| 72 | + allow(LegacyFacter::Util::Config).to receive(:windows?).and_return(true) |
| 73 | + allow(LegacyFacter::Util::Config).to receive(:windows_data_dir).and_return('C:\\ProgramData') |
| 74 | + LegacyFacter::Util::Config.setup_default_ext_facts_dirs |
| 75 | + expect(LegacyFacter::Util::Config.external_facts_dirs) |
| 76 | + .to eq [File.join(ENV['HOME'], '.facter', 'facts.d'), |
| 77 | + File.join(ENV['HOME'], '.puppetlabs', 'opt', 'facter', 'facts.d'), |
| 78 | + File.join('C:\\ProgramData', 'PuppetLabs', 'facter', 'facts.d')] |
| 79 | + end |
| 80 | + |
| 81 | + it "returns the old and new (AIO) paths under user's home directory when not root on windows 2003R2" do |
| 82 | + allow(LegacyFacter::Util::Root).to receive(:root?).and_return(false) |
| 83 | + allow(LegacyFacter::Util::Config).to receive(:windows?).and_return(true) |
| 84 | + allow(LegacyFacter::Util::Config).to receive(:windows_data_dir).and_return('C:\\Documents') |
| 85 | + LegacyFacter::Util::Config.setup_default_ext_facts_dirs |
| 86 | + expect(LegacyFacter::Util::Config.external_facts_dirs) |
| 87 | + .to eq [File.join(ENV['HOME'], '.facter', 'facts.d'), |
| 88 | + File.join(ENV['HOME'], '.puppetlabs', 'opt', 'facter', 'facts.d'), |
| 89 | + File.join('C:\\Documents', 'PuppetLabs', 'facter', 'facts.d')] |
| 90 | + end |
| 91 | + |
| 92 | + it "returns the old and new (AIO) paths under user's home directory when not root on linux" do |
| 93 | + allow(LegacyFacter::Util::Root).to receive(:root?).and_return(false) |
| 94 | + allow(LegacyFacter::Util::Config).to receive(:windows?).and_return(false) |
| 95 | + allow(LegacyFacter::Util::Config).to receive(:windows_data_dir).and_return(nil) |
85 | 96 | LegacyFacter::Util::Config.setup_default_ext_facts_dirs
|
86 | 97 | expect(LegacyFacter::Util::Config.external_facts_dirs)
|
87 | 98 | .to eq [File.join(ENV['HOME'], '.facter', 'facts.d'),
|
88 |
| - File.join(ENV['HOME'], '.puppetlabs', 'opt', 'facter', 'facts.d')] |
| 99 | + File.join(ENV['HOME'], '.puppetlabs', 'opt', 'facter', 'facts.d'), |
| 100 | + '/etc/puppetlabs/facter/facts.d', |
| 101 | + '/etc/facter/facts.d/', |
| 102 | + '/opt/puppetlabs/facter/facts.d'] |
89 | 103 | end
|
90 | 104 |
|
91 | 105 | it 'includes additional values when user appends to the list' do
|
|
0 commit comments