facter 2.4.4-x86-mingw32 → 2.4.5-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/facter/core/execution/posix.rb +2 -2
- data/lib/facter/gid.rb +1 -1
- data/lib/facter/ipaddress.rb +5 -14
- data/lib/facter/ipaddress6.rb +3 -2
- data/lib/facter/macaddress.rb +3 -8
- data/lib/facter/netmask.rb +9 -1
- data/lib/facter/processors/os.rb +1 -1
- data/lib/facter/util/ip.rb +17 -0
- data/lib/facter/util/netmask.rb +0 -6
- data/lib/facter/util/virtual.rb +2 -2
- data/lib/facter/version.rb +1 -1
- data/spec/fixtures/ifconfig/net_route_all_with_multiple_interfaces +2 -0
- data/spec/fixtures/ifconfig/net_route_net_tools_1.60.txt +3 -0
- data/spec/fixtures/unit/ipaddress/net_route_multiple_127_addresses.txt +3 -0
- data/spec/fixtures/unit/ipaddress/net_route_net_tools_1.60.txt +3 -0
- data/spec/fixtures/unit/ipaddress/net_route_non_english_locale.txt +3 -0
- data/spec/fixtures/unit/ipaddress/net_route_ubuntu_1204.txt +3 -0
- data/spec/fixtures/unit/netmask/{darwin_10_8_5.txt → ifconfig_darwin_10_8_5.txt} +0 -0
- data/spec/fixtures/unit/netmask/net_route_multiple_127_addresses.txt +3 -0
- data/spec/fixtures/unit/netmask/net_route_net_tools_1.60.txt +3 -0
- data/spec/fixtures/unit/netmask/net_route_non_english_locale.txt +3 -0
- data/spec/fixtures/unit/netmask/net_route_ubuntu_1204.txt +3 -0
- data/spec/fixtures/virtual/proc_1_cgroup/in_a_docker_container_with_systemd_slices +10 -0
- data/spec/unit/core/execution/posix_spec.rb +10 -0
- data/spec/unit/gid_spec.rb +9 -0
- data/spec/unit/ipaddress6_spec.rb +16 -4
- data/spec/unit/ipaddress_spec.rb +12 -12
- data/spec/unit/macaddress_spec.rb +6 -1
- data/spec/unit/netmask_spec.rb +17 -4
- data/spec/unit/processors/os_spec.rb +2 -0
- data/spec/unit/util/virtual_spec.rb +11 -0
- metadata +26 -4
@@ -11,11 +11,11 @@ class Facter::Core::Execution::Posix < Facter::Core::Execution::Base
|
|
11
11
|
|
12
12
|
def which(bin)
|
13
13
|
if absolute_path?(bin)
|
14
|
-
return bin if File.executable?(bin)
|
14
|
+
return bin if File.executable?(bin) and File.file?(bin)
|
15
15
|
else
|
16
16
|
search_paths.each do |dir|
|
17
17
|
dest = File.join(dir, bin)
|
18
|
-
return dest if File.executable?(dest)
|
18
|
+
return dest if File.executable?(dest) and File.file?(dest)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
nil
|
data/lib/facter/gid.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
Facter.add(:gid) do
|
12
12
|
confine do
|
13
|
-
Facter::Core::Execution.which('id') && Facter.value(:kernel)
|
13
|
+
Facter::Core::Execution.which('id') && !["SunOS", "windows"].include?(Facter.value(:kernel))
|
14
14
|
end
|
15
15
|
setcode { Facter::Core::Execution.exec('id -ng') }
|
16
16
|
end
|
data/lib/facter/ipaddress.rb
CHANGED
@@ -3,7 +3,9 @@
|
|
3
3
|
# Purpose: Return the main IP address for a host.
|
4
4
|
#
|
5
5
|
# Resolution:
|
6
|
-
# On
|
6
|
+
# On Linux and AIX, it examines the routing table and uses the IP address
|
7
|
+
# of the default interface.
|
8
|
+
# On other Unixes does an ifconfig, and returns the first non 127.0.0.0/8
|
7
9
|
# subnetted IP it finds.
|
8
10
|
# On Windows, it attempts to use the socket library and resolve the machine's
|
9
11
|
# hostname via DNS.
|
@@ -27,19 +29,8 @@ require 'facter/util/ip'
|
|
27
29
|
Facter.add(:ipaddress) do
|
28
30
|
confine :kernel => :linux
|
29
31
|
setcode do
|
30
|
-
|
31
|
-
|
32
|
-
if output
|
33
|
-
regexp = /inet (?:addr:)?([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/
|
34
|
-
output.split("\n").each do |line|
|
35
|
-
match = regexp.match(line)
|
36
|
-
if match and not /^127\./.match(match[1])
|
37
|
-
ip = match[1]
|
38
|
-
break
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
ip
|
32
|
+
iface = Facter::Util::IP.linux_default_iface
|
33
|
+
Facter.value("ipaddress_#{iface}")
|
43
34
|
end
|
44
35
|
end
|
45
36
|
|
data/lib/facter/ipaddress6.rb
CHANGED
@@ -37,11 +37,12 @@ def get_address_after_token(output, token, return_first=false)
|
|
37
37
|
ip
|
38
38
|
end
|
39
39
|
|
40
|
+
|
40
41
|
Facter.add(:ipaddress6) do
|
41
42
|
confine :kernel => :linux
|
42
43
|
setcode do
|
43
|
-
|
44
|
-
|
44
|
+
iface = Facter::Util::IP.linux_default_iface
|
45
|
+
Facter.value("ipaddress6_#{iface}")
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
data/lib/facter/macaddress.rb
CHANGED
@@ -12,15 +12,10 @@ require 'facter/util/macaddress'
|
|
12
12
|
require 'facter/util/ip'
|
13
13
|
|
14
14
|
Facter.add(:macaddress) do
|
15
|
-
confine :kernel =>
|
15
|
+
confine :kernel => :linux
|
16
16
|
setcode do
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
String(output).each_line do |s|
|
21
|
-
ether.push($1) if s =~ /(?:ether|HWaddr) ((\w{1,2}:){5,}\w{1,2})/
|
22
|
-
end
|
23
|
-
Facter::Util::Macaddress.standardize(ether[0])
|
17
|
+
iface = Facter::Util::IP.linux_default_iface
|
18
|
+
Facter.value("macaddress_#{iface}")
|
24
19
|
end
|
25
20
|
end
|
26
21
|
|
data/lib/facter/netmask.rb
CHANGED
@@ -16,8 +16,16 @@
|
|
16
16
|
#
|
17
17
|
require 'facter/util/netmask'
|
18
18
|
|
19
|
+
Facter.add(:netmask) do
|
20
|
+
confine :kernel => :linux
|
21
|
+
setcode do
|
22
|
+
iface = Facter::Util::IP.linux_default_iface
|
23
|
+
Facter.value("netmask_#{iface}")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
19
27
|
Facter.add("netmask") do
|
20
|
-
confine :kernel => [ :sunos, :
|
28
|
+
confine :kernel => [ :sunos, :freebsd, :openbsd, :netbsd, :darwin, :"gnu/kfreebsd", :dragonfly, :AIX ]
|
21
29
|
setcode do
|
22
30
|
Facter::NetMask.get_netmask
|
23
31
|
end
|
data/lib/facter/processors/os.rb
CHANGED
@@ -112,7 +112,7 @@ module Facter
|
|
112
112
|
# get each physical processor
|
113
113
|
Facter::Util::WMI.execquery("select * from Win32_Processor").each do |proc|
|
114
114
|
# not supported before 2008
|
115
|
-
if proc.
|
115
|
+
if proc.ole_respond_to?(:NumberOfLogicalProcessors)
|
116
116
|
processor_num = proc.NumberOfLogicalProcessors
|
117
117
|
else
|
118
118
|
processor_num = 1
|
data/lib/facter/util/ip.rb
CHANGED
@@ -337,4 +337,21 @@ module Facter::Util::IP
|
|
337
337
|
network = ip.mask(subnet.to_s).to_s
|
338
338
|
end
|
339
339
|
end
|
340
|
+
|
341
|
+
def self.read_proc_net_route
|
342
|
+
File.read("/proc/net/route")
|
343
|
+
end
|
344
|
+
|
345
|
+
def self.linux_default_iface
|
346
|
+
routes = read_proc_net_route
|
347
|
+
iface = nil
|
348
|
+
routes.split("\n").each do |line|
|
349
|
+
parts = line.split
|
350
|
+
if parts[1] == "00000000"
|
351
|
+
iface = alphafy(parts[0])
|
352
|
+
break
|
353
|
+
end
|
354
|
+
end
|
355
|
+
iface
|
356
|
+
end
|
340
357
|
end
|
data/lib/facter/util/netmask.rb
CHANGED
@@ -5,12 +5,6 @@ module Facter::NetMask
|
|
5
5
|
|
6
6
|
ops = nil
|
7
7
|
case Facter.value(:kernel)
|
8
|
-
when 'Linux'
|
9
|
-
ops = {
|
10
|
-
:ifconfig_opts => ['2>/dev/null'],
|
11
|
-
:regex => %r{#{Facter.value(:ipaddress)}.*?(?:Mask:|netmask)\s*(#{ipregex})}x,
|
12
|
-
:munge => nil,
|
13
|
-
}
|
14
8
|
when 'SunOS'
|
15
9
|
ops = {
|
16
10
|
:ifconfig_opts => ['-a'],
|
data/lib/facter/util/virtual.rb
CHANGED
@@ -162,7 +162,7 @@ module Facter::Util::Virtual
|
|
162
162
|
path = Pathname.new('/proc/1/cgroup')
|
163
163
|
return false unless path.readable?
|
164
164
|
begin
|
165
|
-
in_lxc = path.readlines.any? {|l| l.split(":")[2].to_s.
|
165
|
+
in_lxc = path.readlines.any? {|l| l.split(":")[2].to_s.include? '/lxc' }
|
166
166
|
rescue Errno::EPERM => exc
|
167
167
|
# If we get "operation not permitted" here, it probably means we are
|
168
168
|
# running OpenVZ. We are not running LXC anyway, so...
|
@@ -179,7 +179,7 @@ module Facter::Util::Virtual
|
|
179
179
|
path = Pathname.new('/proc/1/cgroup')
|
180
180
|
return false unless path.readable?
|
181
181
|
begin
|
182
|
-
in_docker = path.readlines.any? {|l| l.split(":")[2].to_s.
|
182
|
+
in_docker = path.readlines.any? {|l| l.split(":")[2].to_s.include? '/docker' }
|
183
183
|
rescue Errno::EPERM => exc
|
184
184
|
# This can fail under OpenVZ, just like in .lxc?
|
185
185
|
return false
|
data/lib/facter/version.rb
CHANGED
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
10:hugetlb:/
|
2
|
+
9:perf_event:/
|
3
|
+
8:blkio:/system.slice/docker-8255e18aa44c5809a33db5f324a4b34e3a73b246394e4070cff752cd84d79a6d.scope
|
4
|
+
7:net_cls:/
|
5
|
+
6:freezer:/system.slice/docker-8255e18aa44c5809a33db5f324a4b34e3a73b246394e4070cff752cd84d79a6d.scope
|
6
|
+
5:devices:/system.slice/docker-8255e18aa44c5809a33db5f324a4b34e3a73b246394e4070cff752cd84d79a6d.scope
|
7
|
+
4:memory:/system.slice/docker-8255e18aa44c5809a33db5f324a4b34e3a73b246394e4070cff752cd84d79a6d.scope
|
8
|
+
3:cpuacct,cpu:/system.slice/docker-8255e18aa44c5809a33db5f324a4b34e3a73b246394e4070cff752cd84d79a6d.scope
|
9
|
+
2:cpuset:/system.slice/docker-8255e18aa44c5809a33db5f324a4b34e3a73b246394e4070cff752cd84d79a6d.scope
|
10
|
+
1:name=systemd:/system.slice/docker-8255e18aa44c5809a33db5f324a4b34e3a73b246394e4070cff752cd84d79a6d.scope
|
@@ -16,6 +16,7 @@ describe Facter::Core::Execution::Posix, :unless => Facter::Util::Config.is_wind
|
|
16
16
|
|
17
17
|
context "and provided with an absolute path" do
|
18
18
|
it "should return the binary if executable" do
|
19
|
+
File.expects(:file?).with('/opt/foo').returns true
|
19
20
|
File.expects(:executable?).with('/opt/foo').returns true
|
20
21
|
subject.which('/opt/foo').should == '/opt/foo'
|
21
22
|
end
|
@@ -24,12 +25,21 @@ describe Facter::Core::Execution::Posix, :unless => Facter::Util::Config.is_wind
|
|
24
25
|
File.expects(:executable?).with('/opt/foo').returns false
|
25
26
|
subject.which('/opt/foo').should be_nil
|
26
27
|
end
|
28
|
+
|
29
|
+
it "should return nil if the binary is not a file" do
|
30
|
+
File.expects(:file?).with('/opt/foo').returns false
|
31
|
+
File.expects(:executable?).with('/opt/foo').returns true
|
32
|
+
subject.which('/opt/foo').should be_nil
|
33
|
+
end
|
27
34
|
end
|
28
35
|
|
29
36
|
context "and not provided with an absolute path" do
|
30
37
|
it "should return the absolute path if found" do
|
38
|
+
File.expects(:file?).with('/bin/foo').never
|
31
39
|
File.expects(:executable?).with('/bin/foo').returns false
|
40
|
+
File.expects(:file?).with('/sbin/foo').returns true
|
32
41
|
File.expects(:executable?).with('/sbin/foo').returns true
|
42
|
+
File.expects(:file?).with('/usr/sbin/foo').never
|
33
43
|
File.expects(:executable?).with('/usr/sbin/foo').never
|
34
44
|
subject.which('foo').should == '/sbin/foo'
|
35
45
|
end
|
data/spec/unit/gid_spec.rb
CHANGED
@@ -39,4 +39,13 @@ describe "gid fact" do
|
|
39
39
|
Facter.fact(:gid).value.should == nil
|
40
40
|
end
|
41
41
|
end
|
42
|
+
|
43
|
+
describe "on windows systems" do
|
44
|
+
it "is not supported" do
|
45
|
+
Facter.fact(:kernel).stubs(:value).returns("windows")
|
46
|
+
Facter::Core::Execution.expects(:which).with('id').returns(true)
|
47
|
+
|
48
|
+
Facter.fact(:gid).value.should == nil
|
49
|
+
end
|
50
|
+
end
|
42
51
|
end
|
@@ -26,8 +26,11 @@ describe "The IPv6 address fact" do
|
|
26
26
|
it "should return ipaddress6 information for Linux" do
|
27
27
|
Facter::Core::Execution.stubs(:exec).with('uname -s').returns('Linux')
|
28
28
|
Facter::Util::IP.stubs(:get_ifconfig).returns("/sbin/ifconfig")
|
29
|
-
Facter::Util::IP.stubs(:exec_ifconfig).
|
29
|
+
Facter::Util::IP.stubs(:exec_ifconfig).
|
30
30
|
returns(ifconfig_fixture('linux_ifconfig_all_with_multiple_interfaces'))
|
31
|
+
routes = ifconfig_fixture('net_route_all_with_multiple_interfaces')
|
32
|
+
Facter::Util::IP.stubs(:read_proc_net_route).returns(routes)
|
33
|
+
Facter.collection.internal_loader.load(:interfaces)
|
31
34
|
|
32
35
|
Facter.value(:ipaddress6).should == "2610:10:20:209:212:3fff:febe:2201"
|
33
36
|
end
|
@@ -35,8 +38,11 @@ describe "The IPv6 address fact" do
|
|
35
38
|
it "should return ipaddress6 information for Linux with recent net-tools" do
|
36
39
|
Facter::Core::Execution.stubs(:exec).with('uname -s').returns('Linux')
|
37
40
|
Facter::Util::IP.stubs(:get_ifconfig).returns("/sbin/ifconfig")
|
38
|
-
Facter::Util::IP.stubs(:exec_ifconfig).
|
41
|
+
Facter::Util::IP.stubs(:exec_ifconfig).
|
39
42
|
returns(ifconfig_fixture('ifconfig_net_tools_1.60.txt'))
|
43
|
+
routes = ifconfig_fixture('net_route_net_tools_1.60.txt')
|
44
|
+
Facter::Util::IP.stubs(:read_proc_net_route).returns(routes)
|
45
|
+
Facter.collection.internal_loader.load(:interfaces)
|
40
46
|
|
41
47
|
Facter.value(:ipaddress6).should == "2610:10:20:209:212:3fff:febe:2201"
|
42
48
|
end
|
@@ -44,8 +50,11 @@ describe "The IPv6 address fact" do
|
|
44
50
|
it "should return ipaddress6 with fe80 in any other octet than the first for Linux" do
|
45
51
|
Facter::Core::Execution.stubs(:exec).with('uname -s').returns('Linux')
|
46
52
|
Facter::Util::IP.stubs(:get_ifconfig).returns("/sbin/ifconfig")
|
47
|
-
Facter::Util::IP.stubs(:exec_ifconfig).
|
53
|
+
Facter::Util::IP.stubs(:exec_ifconfig).
|
48
54
|
returns(ifconfig_fixture('linux_ifconfig_all_with_multiple_interfaces_and_fe80'))
|
55
|
+
routes = ifconfig_fixture('net_route_all_with_multiple_interfaces')
|
56
|
+
Facter::Util::IP.stubs(:read_proc_net_route).returns(routes)
|
57
|
+
Facter.collection.internal_loader.load(:interfaces)
|
49
58
|
|
50
59
|
Facter.value(:ipaddress6).should == "2610:10:20:209:212:3fff:fe80:2201"
|
51
60
|
end
|
@@ -53,8 +62,11 @@ describe "The IPv6 address fact" do
|
|
53
62
|
it "should not return ipaddress6 link-local address for Linux" do
|
54
63
|
Facter::Core::Execution.stubs(:exec).with('uname -s').returns('Linux')
|
55
64
|
Facter::Util::IP.stubs(:get_ifconfig).returns("/sbin/ifconfig")
|
56
|
-
Facter::Util::IP.stubs(:exec_ifconfig).
|
65
|
+
Facter::Util::IP.stubs(:exec_ifconfig).
|
57
66
|
returns(ifconfig_fixture('linux_ifconfig_all_with_multiple_interfaces_and_no_public_ipv6'))
|
67
|
+
routes = ifconfig_fixture('net_route_all_with_multiple_interfaces')
|
68
|
+
Facter::Util::IP.stubs(:read_proc_net_route).returns(routes)
|
69
|
+
Facter.collection.internal_loader.load(:interfaces)
|
58
70
|
|
59
71
|
Facter.value(:ipaddress6).should be_false
|
60
72
|
end
|
data/spec/unit/ipaddress_spec.rb
CHANGED
@@ -4,10 +4,6 @@ require 'spec_helper'
|
|
4
4
|
require 'facter/util/ip'
|
5
5
|
|
6
6
|
describe "ipaddress fact" do
|
7
|
-
before do
|
8
|
-
Facter.collection.internal_loader.load(:ipaddress)
|
9
|
-
end
|
10
|
-
|
11
7
|
context 'using `ifconfig`' do
|
12
8
|
before :each do
|
13
9
|
Facter.fact(:hostname).stubs(:value)
|
@@ -18,25 +14,29 @@ describe "ipaddress fact" do
|
|
18
14
|
Facter.fact(:kernel).stubs(:value).returns("Linux")
|
19
15
|
end
|
20
16
|
|
17
|
+
after :each do
|
18
|
+
Facter.collection.flush
|
19
|
+
end
|
20
|
+
|
21
21
|
def expect_ifconfig_parse(address, fixture)
|
22
|
-
Facter::Util::IP.stubs(:exec_ifconfig).returns(my_fixture_read(fixture))
|
22
|
+
Facter::Util::IP.stubs(:exec_ifconfig).returns(my_fixture_read("ifconfig_#{fixture}"))
|
23
|
+
routes = my_fixture_read("net_route_#{fixture}")
|
24
|
+
Facter::Util::IP.stubs(:read_proc_net_route).returns(routes)
|
25
|
+
Facter.collection.internal_loader.load(:interfaces)
|
26
|
+
Facter.collection.internal_loader.load(:ipaddress)
|
23
27
|
Facter.fact(:ipaddress).value.should == address
|
24
28
|
end
|
25
29
|
|
26
30
|
it "parses correctly on Ubuntu 12.04" do
|
27
|
-
expect_ifconfig_parse "10.87.80.110", "
|
31
|
+
expect_ifconfig_parse "10.87.80.110", "ubuntu_1204.txt"
|
28
32
|
end
|
29
33
|
|
30
34
|
it "parses correctly on Fedora 17" do
|
31
|
-
expect_ifconfig_parse "131.252.209.153", "
|
32
|
-
end
|
33
|
-
|
34
|
-
it "parses a real address over multiple loopback addresses" do
|
35
|
-
expect_ifconfig_parse "10.0.222.20", "ifconfig_multiple_127_addresses.txt"
|
35
|
+
expect_ifconfig_parse "131.252.209.153", "net_tools_1.60.txt"
|
36
36
|
end
|
37
37
|
|
38
38
|
it "parses nothing with a non-english locale" do
|
39
|
-
expect_ifconfig_parse nil, "
|
39
|
+
expect_ifconfig_parse nil, "non_english_locale.txt"
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -23,8 +23,11 @@ describe "macaddress fact" do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should return the macaddress of the first interface" do
|
26
|
-
Facter::Util::IP.stubs(:exec_ifconfig).
|
26
|
+
Facter::Util::IP.stubs(:exec_ifconfig).
|
27
27
|
returns(ifconfig_fixture('linux_ifconfig_all_with_multiple_interfaces'))
|
28
|
+
routes = ifconfig_fixture("net_route_all_with_multiple_interfaces")
|
29
|
+
Facter::Util::IP.stubs(:read_proc_net_route).returns(routes)
|
30
|
+
Facter.collection.internal_loader.load(:interfaces)
|
28
31
|
|
29
32
|
Facter.value(:macaddress).should == "00:12:3f:be:22:01"
|
30
33
|
end
|
@@ -32,6 +35,7 @@ describe "macaddress fact" do
|
|
32
35
|
it "should return nil when no macaddress can be found" do
|
33
36
|
Facter::Util::IP.stubs(:exec_ifconfig).with(["-a","2>/dev/null"]).
|
34
37
|
returns(ifconfig_fixture('linux_ifconfig_no_mac'))
|
38
|
+
Facter::Util::IP.stubs(:read_proc_net_route).returns("")
|
35
39
|
|
36
40
|
proc { Facter.value(:macaddress) }.should_not raise_error
|
37
41
|
Facter.value(:macaddress).should be_nil
|
@@ -41,6 +45,7 @@ describe "macaddress fact" do
|
|
41
45
|
it "should return nil when no interface has a real macaddress" do
|
42
46
|
Facter::Util::IP.stubs(:exec_ifconfig).with(["-a","2>/dev/null"]).
|
43
47
|
returns(ifconfig_fixture('linux_ifconfig_venet'))
|
48
|
+
Facter::Util::IP.stubs(:read_proc_net_route).returns("")
|
44
49
|
|
45
50
|
proc { Facter.value(:macaddress) }.should_not raise_error
|
46
51
|
Facter.value(:macaddress).should be_nil
|
data/spec/unit/netmask_spec.rb
CHANGED
@@ -6,8 +6,21 @@ require 'facter/util/ip'
|
|
6
6
|
|
7
7
|
shared_examples_for "netmask from ifconfig output" do |platform, address, fixture|
|
8
8
|
it "correctly on #{platform}" do
|
9
|
-
Facter::Util::IP.stubs(:exec_ifconfig).returns(my_fixture_read(fixture))
|
9
|
+
Facter::Util::IP.stubs(:exec_ifconfig).returns(my_fixture_read("ifconfig_#{fixture}"))
|
10
10
|
Facter.collection.internal_loader.load(:netmask)
|
11
|
+
begin
|
12
|
+
routes = my_fixture_read("net_route_#{fixture}")
|
13
|
+
Facter::Util::IP.stubs(:read_proc_net_route).returns(routes)
|
14
|
+
rescue RuntimeError
|
15
|
+
# We want to try to load proc/net/route fixtures, but skip if
|
16
|
+
# they don't exist for non-linux platforms. Ideally we'd get an
|
17
|
+
# IOError here, but the fixture machinery here is dumb and
|
18
|
+
# converts this to a RuntimeError. Hopefully anything that would
|
19
|
+
# error here would also cause the actual test to fail, so I'm
|
20
|
+
# not going to worry too hard.
|
21
|
+
end
|
22
|
+
Facter.collection.internal_loader.load(:interfaces)
|
23
|
+
Facter.collection.internal_loader.load(:ipaddress)
|
11
24
|
|
12
25
|
Facter.fact(:netmask).value.should eq(address)
|
13
26
|
end
|
@@ -21,10 +34,10 @@ describe "The netmask fact" do
|
|
21
34
|
|
22
35
|
example_behavior_for "netmask from ifconfig output",
|
23
36
|
"Archlinux (net-tools 1.60)", "255.255.255.0",
|
24
|
-
"
|
37
|
+
"net_tools_1.60.txt"
|
25
38
|
example_behavior_for "netmask from ifconfig output",
|
26
39
|
"Ubuntu 12.04", "255.255.255.255",
|
27
|
-
"
|
40
|
+
"ubuntu_1204.txt"
|
28
41
|
end
|
29
42
|
|
30
43
|
context "on AIX" do
|
@@ -34,7 +47,7 @@ describe "The netmask fact" do
|
|
34
47
|
|
35
48
|
example_behavior_for "netmask from ifconfig output",
|
36
49
|
"AIX 7", "255.255.255.0",
|
37
|
-
"
|
50
|
+
"aix_7.txt"
|
38
51
|
|
39
52
|
end
|
40
53
|
|
@@ -221,6 +221,7 @@ describe Facter::Processors::Windows do
|
|
221
221
|
before :each do
|
222
222
|
proc = stubs 'proc'
|
223
223
|
proc.stubs(:Name).returns("Intel(R) Celeron(R) processor")
|
224
|
+
proc.stubs(:ole_respond_to?).with(:NumberOfLogicalProcessors).returns(false)
|
224
225
|
load(Array.new(2, proc))
|
225
226
|
end
|
226
227
|
|
@@ -235,6 +236,7 @@ describe Facter::Processors::Windows do
|
|
235
236
|
before :each do
|
236
237
|
proc = stubs 'proc'
|
237
238
|
proc.stubs(:NumberOfLogicalProcessors).returns(2)
|
239
|
+
proc.stubs(:ole_respond_to?).with(:NumberOfLogicalProcessors).returns(true)
|
238
240
|
proc.stubs(:Name).returns("Intel(R) Celeron(R) processor")
|
239
241
|
load(Array.new(2, proc))
|
240
242
|
end
|
@@ -368,6 +368,17 @@ describe Facter::Util::Virtual do
|
|
368
368
|
end
|
369
369
|
end
|
370
370
|
|
371
|
+
context '/proc/1/cgroup has at least one hierarchy with docker underneath a systemd slice parent' do
|
372
|
+
before :each do
|
373
|
+
fakepath = Pathname.new(File.join(fixture_path, 'in_a_docker_container_with_systemd_slices'))
|
374
|
+
Pathname.stubs(:new).with('/proc/1/cgroup').returns(fakepath)
|
375
|
+
end
|
376
|
+
|
377
|
+
it 'is true' do
|
378
|
+
subject.should be_true
|
379
|
+
end
|
380
|
+
end
|
381
|
+
|
371
382
|
context '/proc/1/cgroup has no hierarchies rooted in /docker/' do
|
372
383
|
before :each do
|
373
384
|
fakepath = Pathname.new(File.join(fixture_path, 'not_in_a_container'))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.5
|
5
5
|
prerelease:
|
6
6
|
platform: x86-mingw32
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-01-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
@@ -265,6 +265,7 @@ files:
|
|
265
265
|
- spec/fixtures/cpuinfo/two_multicore-grep
|
266
266
|
- spec/fixtures/virtual/proc_1_cgroup/in_a_container
|
267
267
|
- spec/fixtures/virtual/proc_1_cgroup/not_in_a_container
|
268
|
+
- spec/fixtures/virtual/proc_1_cgroup/in_a_docker_container_with_systemd_slices
|
268
269
|
- spec/fixtures/virtual/proc_1_cgroup/in_a_docker_container
|
269
270
|
- spec/fixtures/virtual/proc_self_status/vserver_2_1/guest
|
270
271
|
- spec/fixtures/virtual/proc_self_status/vserver_2_1/host
|
@@ -283,8 +284,12 @@ files:
|
|
283
284
|
- spec/fixtures/processorcount/solaris-psrinfo
|
284
285
|
- spec/fixtures/unit/netmask/ifconfig_ubuntu_1204.txt
|
285
286
|
- spec/fixtures/unit/netmask/ifconfig_net_tools_1.60.txt
|
287
|
+
- spec/fixtures/unit/netmask/net_route_ubuntu_1204.txt
|
288
|
+
- spec/fixtures/unit/netmask/net_route_multiple_127_addresses.txt
|
286
289
|
- spec/fixtures/unit/netmask/ifconfig_aix_7.txt
|
287
|
-
- spec/fixtures/unit/netmask/
|
290
|
+
- spec/fixtures/unit/netmask/net_route_non_english_locale.txt
|
291
|
+
- spec/fixtures/unit/netmask/net_route_net_tools_1.60.txt
|
292
|
+
- spec/fixtures/unit/netmask/ifconfig_darwin_10_8_5.txt
|
288
293
|
- spec/fixtures/unit/selinux/selinux_sestatus2
|
289
294
|
- spec/fixtures/unit/selinux/selinux_sestatus
|
290
295
|
- spec/fixtures/unit/filesystems/linux
|
@@ -362,8 +367,12 @@ files:
|
|
362
367
|
- spec/fixtures/unit/ec2/rest/meta-data/root
|
363
368
|
- spec/fixtures/unit/ipaddress/ifconfig_ubuntu_1204.txt
|
364
369
|
- spec/fixtures/unit/ipaddress/ifconfig_net_tools_1.60.txt
|
370
|
+
- spec/fixtures/unit/ipaddress/net_route_ubuntu_1204.txt
|
371
|
+
- spec/fixtures/unit/ipaddress/net_route_multiple_127_addresses.txt
|
365
372
|
- spec/fixtures/unit/ipaddress/ifconfig_non_english_locale.txt
|
373
|
+
- spec/fixtures/unit/ipaddress/net_route_non_english_locale.txt
|
366
374
|
- spec/fixtures/unit/ipaddress/ifconfig_multiple_127_addresses.txt
|
375
|
+
- spec/fixtures/unit/ipaddress/net_route_net_tools_1.60.txt
|
367
376
|
- spec/fixtures/unit/processors/os/darwin-system-profiler
|
368
377
|
- spec/fixtures/unit/zfs_version/zfs_new
|
369
378
|
- spec/fixtures/unit/zfs_version/solaris_11
|
@@ -408,6 +417,7 @@ files:
|
|
408
417
|
- spec/fixtures/unit/zpool_version/freebsd_8.2
|
409
418
|
- spec/fixtures/unit/zpool_version/solaris_10
|
410
419
|
- spec/fixtures/ifconfig/open_solaris_b132
|
420
|
+
- spec/fixtures/ifconfig/net_route_all_with_multiple_interfaces
|
411
421
|
- spec/fixtures/ifconfig/ifconfig_ubuntu_1204.txt
|
412
422
|
- spec/fixtures/ifconfig/freebsd_6_0
|
413
423
|
- spec/fixtures/ifconfig/linux_ifconfig_venet
|
@@ -431,6 +441,7 @@ files:
|
|
431
441
|
- spec/fixtures/ifconfig/darwin_10_3_0_en0
|
432
442
|
- spec/fixtures/ifconfig/darwin_ifconfig_all_with_multiple_interfaces
|
433
443
|
- spec/fixtures/ifconfig/open_solaris_10
|
444
|
+
- spec/fixtures/ifconfig/net_route_net_tools_1.60.txt
|
434
445
|
- spec/fixtures/ifconfig/darwin_10_6_6_dualstack_en1
|
435
446
|
- spec/fixtures/ifconfig/darwin_10_6_6_dualstack
|
436
447
|
- spec/fixtures/ifconfig/ubuntu_7_04_eth0
|
@@ -613,6 +624,7 @@ test_files:
|
|
613
624
|
- spec/fixtures/cpuinfo/two_multicore-grep
|
614
625
|
- spec/fixtures/virtual/proc_1_cgroup/in_a_container
|
615
626
|
- spec/fixtures/virtual/proc_1_cgroup/not_in_a_container
|
627
|
+
- spec/fixtures/virtual/proc_1_cgroup/in_a_docker_container_with_systemd_slices
|
616
628
|
- spec/fixtures/virtual/proc_1_cgroup/in_a_docker_container
|
617
629
|
- spec/fixtures/virtual/proc_self_status/vserver_2_1/guest
|
618
630
|
- spec/fixtures/virtual/proc_self_status/vserver_2_1/host
|
@@ -631,8 +643,12 @@ test_files:
|
|
631
643
|
- spec/fixtures/processorcount/solaris-psrinfo
|
632
644
|
- spec/fixtures/unit/netmask/ifconfig_ubuntu_1204.txt
|
633
645
|
- spec/fixtures/unit/netmask/ifconfig_net_tools_1.60.txt
|
646
|
+
- spec/fixtures/unit/netmask/net_route_ubuntu_1204.txt
|
647
|
+
- spec/fixtures/unit/netmask/net_route_multiple_127_addresses.txt
|
634
648
|
- spec/fixtures/unit/netmask/ifconfig_aix_7.txt
|
635
|
-
- spec/fixtures/unit/netmask/
|
649
|
+
- spec/fixtures/unit/netmask/net_route_non_english_locale.txt
|
650
|
+
- spec/fixtures/unit/netmask/net_route_net_tools_1.60.txt
|
651
|
+
- spec/fixtures/unit/netmask/ifconfig_darwin_10_8_5.txt
|
636
652
|
- spec/fixtures/unit/selinux/selinux_sestatus2
|
637
653
|
- spec/fixtures/unit/selinux/selinux_sestatus
|
638
654
|
- spec/fixtures/unit/filesystems/linux
|
@@ -710,8 +726,12 @@ test_files:
|
|
710
726
|
- spec/fixtures/unit/ec2/rest/meta-data/root
|
711
727
|
- spec/fixtures/unit/ipaddress/ifconfig_ubuntu_1204.txt
|
712
728
|
- spec/fixtures/unit/ipaddress/ifconfig_net_tools_1.60.txt
|
729
|
+
- spec/fixtures/unit/ipaddress/net_route_ubuntu_1204.txt
|
730
|
+
- spec/fixtures/unit/ipaddress/net_route_multiple_127_addresses.txt
|
713
731
|
- spec/fixtures/unit/ipaddress/ifconfig_non_english_locale.txt
|
732
|
+
- spec/fixtures/unit/ipaddress/net_route_non_english_locale.txt
|
714
733
|
- spec/fixtures/unit/ipaddress/ifconfig_multiple_127_addresses.txt
|
734
|
+
- spec/fixtures/unit/ipaddress/net_route_net_tools_1.60.txt
|
715
735
|
- spec/fixtures/unit/processors/os/darwin-system-profiler
|
716
736
|
- spec/fixtures/unit/zfs_version/zfs_new
|
717
737
|
- spec/fixtures/unit/zfs_version/solaris_11
|
@@ -756,6 +776,7 @@ test_files:
|
|
756
776
|
- spec/fixtures/unit/zpool_version/freebsd_8.2
|
757
777
|
- spec/fixtures/unit/zpool_version/solaris_10
|
758
778
|
- spec/fixtures/ifconfig/open_solaris_b132
|
779
|
+
- spec/fixtures/ifconfig/net_route_all_with_multiple_interfaces
|
759
780
|
- spec/fixtures/ifconfig/ifconfig_ubuntu_1204.txt
|
760
781
|
- spec/fixtures/ifconfig/freebsd_6_0
|
761
782
|
- spec/fixtures/ifconfig/linux_ifconfig_venet
|
@@ -779,6 +800,7 @@ test_files:
|
|
779
800
|
- spec/fixtures/ifconfig/darwin_10_3_0_en0
|
780
801
|
- spec/fixtures/ifconfig/darwin_ifconfig_all_with_multiple_interfaces
|
781
802
|
- spec/fixtures/ifconfig/open_solaris_10
|
803
|
+
- spec/fixtures/ifconfig/net_route_net_tools_1.60.txt
|
782
804
|
- spec/fixtures/ifconfig/darwin_10_6_6_dualstack_en1
|
783
805
|
- spec/fixtures/ifconfig/darwin_10_6_6_dualstack
|
784
806
|
- spec/fixtures/ifconfig/ubuntu_7_04_eth0
|