facter 2.5.6 → 2.5.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4538088004cbcac0680166bcac1523021be9732a956a608fdfe7ab95e320eec
4
- data.tar.gz: 49e50390a5b7760ec839ee9a907c863ce06f966552ab5be562d4a616f51e6ac5
3
+ metadata.gz: b34bbe982e5dffe7309cf07118c0f911502f6cbbdf3f642889dcd391eee35732
4
+ data.tar.gz: 78e7f350f3d0e03a58f72d752f7c405fa3c29c11942ee0bb939afe02a770d386
5
5
  SHA512:
6
- metadata.gz: 80f92f1943f78cd483746d0262e67a92c597b38276a4664a610cb4e4a75f0fa88428faf902e7009c1fb5f3c0e1a3c2645b2129b9b3efb694396ae3eab65981fc
7
- data.tar.gz: 71258f517b4a3ce7be3cc650b7db6e28cd6c9aed88b9804c75cd26623837d86bdc545e93713e6e6440c77afacb64c09efb1fd41c79c40871b961de296d909cc1
6
+ metadata.gz: 488694e5c051c68dd9cc7c4e8f741246bc971bdcd69dbbfcdbf134e2b83c6717411e70f48a422e9ff870392250cb461b0f310a5fa4a48647c2b5a189eaae4470
7
+ data.tar.gz: 487424cfc01da49bc1ef6d35e86c869ca83b16d4c1f765c31a6777ee16ba0e3de498f4c7f2af6fa241f29809cd3e3ec5c7a392ebe6f7e2ee7f110a5c34fb252f
@@ -20,7 +20,7 @@ require 'facter/ec2/rest' unless defined?(Facter::EC2)
20
20
  Facter.define_fact(:ec2_metadata) do
21
21
  define_resolution(:rest) do
22
22
  confine do
23
- Facter.value(:virtual).match /^(xen|kvm)/
23
+ Facter.value(:virtual).match /^(xen|kvm|nitro|ec2)/
24
24
  end
25
25
 
26
26
  @querier = Facter::EC2::Metadata.new
@@ -37,7 +37,7 @@ end
37
37
  Facter.define_fact(:ec2_userdata) do
38
38
  define_resolution(:rest) do
39
39
  confine do
40
- Facter.value(:virtual).match /^(xen|kvm)/
40
+ Facter.value(:virtual).match /^(xen|kvm|nitro|ec2)/
41
41
  end
42
42
 
43
43
  @querier = Facter::EC2::Userdata.new
@@ -17,7 +17,7 @@ module Facter
17
17
  Timeout::Error,
18
18
  ]
19
19
 
20
- METADATA_URL = "http://metadata/computeMetadata/v1beta1/?recursive=true&alt=json"
20
+ METADATA_URL = "http://metadata/computeMetadata/v1/?recursive=true&alt=json"
21
21
 
22
22
  def initialize(url = METADATA_URL)
23
23
  @url = url
@@ -45,7 +45,7 @@ module Facter
45
45
 
46
46
  begin
47
47
  Timeout.timeout(timeout) do
48
- body = open(@url, :proxy => nil).read
48
+ body = open(@url, options={:proxy => nil, "Metadata-Flavor" => "Google"}).read
49
49
  end
50
50
  rescue *CONNECTION_ERRORS => e
51
51
  attempts = attempts + 1
@@ -163,7 +163,7 @@ module Facter::Util::IP
163
163
  ifconfig_output = Facter::Util::IP.ifconfig_interface(interface)
164
164
  if interface =~ /^ib/ then
165
165
  real_mac_address = get_infiniband_macaddress(interface)
166
- output = ifconfig_output.sub(%r{(?:ether|HWaddr)\s+((\w{1,2}:){5,}\w{1,2})}, "HWaddr #{real_mac_address}")
166
+ output = ifconfig_output.sub(%r{(?:ether|HWaddr|infiniband)\s+((\w{1,2}:){5,}\w{1,2})}, "HWaddr #{real_mac_address}")
167
167
  else
168
168
  output = ifconfig_output
169
169
  end
@@ -106,6 +106,10 @@ module Facter::Util::Virtual
106
106
  end
107
107
  end
108
108
 
109
+ def self.ec2?
110
+ File.read("/sys/devices/virtual/dmi/id/bios_vendor") =~ /Amazon EC2/ rescue false
111
+ end
112
+
109
113
  def self.kvm?
110
114
  txt = if FileTest.exists?("/proc/cpuinfo")
111
115
  File.read("/proc/cpuinfo")
@@ -142,6 +146,10 @@ module Facter::Util::Virtual
142
146
  File.read("/sys/devices/virtual/dmi/id/product_name") =~ /Google/ rescue false
143
147
  end
144
148
 
149
+ def self.nitro?
150
+ File.read("/sys/devices/virtual/dmi/id/bios_vendor") =~ /Amazon/ rescue false
151
+ end
152
+
145
153
  def self.jail?
146
154
  path = case Facter.value(:kernel)
147
155
  when "FreeBSD" then "/sbin"
@@ -1,6 +1,6 @@
1
1
  module Facter
2
2
  if not defined? FACTERVERSION then
3
- FACTERVERSION = '2.5.6'
3
+ FACTERVERSION = '2.5.7'
4
4
  end
5
5
 
6
6
  # Returns the running version of Facter.
@@ -145,10 +145,15 @@ Facter.add("virtual") do
145
145
  next "xenu" if FileTest.exists?("/proc/xen") || FileTest.exists?("/dev/xvda1")
146
146
  end
147
147
 
148
+ if Facter::Util::Virtual.ec2?
149
+ next "ec2" if FileTest.exists?("/dev/nvme0")
150
+ end
151
+
148
152
  next "virtualbox" if Facter::Util::Virtual.virtualbox?
149
153
  next Facter::Util::Virtual.kvm_type if Facter::Util::Virtual.kvm?
150
154
  next "rhev" if Facter::Util::Virtual.rhev?
151
155
  next "ovirt" if Facter::Util::Virtual.ovirt?
156
+ next "nitro" if Facter::Util::Virtual.nitro?
152
157
 
153
158
  # Parse lspci
154
159
  output = Facter::Util::Virtual.lspci
@@ -225,6 +230,10 @@ Facter.add("virtual") do
225
230
  result = "xen"
226
231
  end
227
232
 
233
+ if result.nil? and computersystem.manufacturer =~ /Amazon/
234
+ result = "nitro"
235
+ end
236
+
228
237
  break
229
238
  end
230
239
  result ||= "physical"
@@ -0,0 +1,8 @@
1
+ ib0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 2044
2
+ inet 10.55.200.50 netmask 255.255.0.0 broadcast 10.55.255.255
3
+ Infiniband hardware address can be incorrect! Please read BUGS section in ifconfig(8).
4
+ HWaddr 80:00:00:03:fe:80:00:00:00:00:00:00:00:11:75:00:00:6f:02:fe txqueuelen 256 (InfiniBand)
5
+ RX packets 26603237 bytes 15921365732 (14.8 GiB)
6
+ RX errors 0 dropped 0 overruns 0 frame 0
7
+ TX packets 22735277 bytes 4196650455 (3.9 GiB)
8
+ TX errors 0 dropped 2 overruns 0 carrier 0 collisions 0
@@ -0,0 +1,8 @@
1
+ ib0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 2044
2
+ inet 10.55.200.50 netmask 255.255.0.0 broadcast 10.55.255.255
3
+ Infiniband hardware address can be incorrect! Please read BUGS section in ifconfig(8).
4
+ infiniband 80:00:00:03:FE:80:00:00:00:00:00:00:00:00:00:00:00:00:00:00 txqueuelen 256 (InfiniBand)
5
+ RX packets 26603237 bytes 15921365732 (14.8 GiB)
6
+ RX errors 0 dropped 0 overruns 0 frame 0
7
+ TX packets 22735277 bytes 4196650455 (3.9 GiB)
8
+ TX errors 0 dropped 2 overruns 0 carrier 0 collisions 0
@@ -176,6 +176,26 @@ describe Facter::Util::IP do
176
176
  Facter::Util::IP.get_single_interface_output("ib0").should == correct_ifconfig_interface
177
177
  end
178
178
 
179
+ it "should return correct macaddress information for infiniband on Linux CentOS 7" do
180
+ correct_ifconfig_interface = my_fixture_read("linux_get_single_interface_ib0_centos7")
181
+
182
+ Facter::Util::IP.expects(:get_single_interface_output).with("ib0").returns(correct_ifconfig_interface)
183
+ Facter.stubs(:value).with(:kernel).returns("Linux")
184
+
185
+ Facter::Util::IP.get_interface_value("ib0", "macaddress").should == "80:00:00:03:fe:80:00:00:00:00:00:00:00:11:75:00:00:6f:02:fe"
186
+ end
187
+
188
+ it "should replace the incorrect macaddress with the correct macaddress in ifconfig for infiniband on Linux CentOS 7" do
189
+ ifconfig_interface = my_fixture_read("linux_ifconfig_ib0_centos7")
190
+ correct_ifconfig_interface = my_fixture_read("linux_get_single_interface_ib0_centos7")
191
+
192
+ Facter::Util::IP.expects(:get_infiniband_macaddress).with("ib0").returns("80:00:00:03:fe:80:00:00:00:00:00:00:00:11:75:00:00:6f:02:fe")
193
+ Facter::Util::IP.expects(:ifconfig_interface).with("ib0").returns(ifconfig_interface)
194
+ Facter.stubs(:value).with(:kernel).returns("Linux")
195
+
196
+ Facter::Util::IP.get_single_interface_output("ib0").should == correct_ifconfig_interface
197
+ end
198
+
179
199
  it "should return fake macaddress information for infiniband on Linux when neither sysfs or /sbin/ip are available" do
180
200
  ifconfig_interface = my_fixture_read("linux_ifconfig_ib0")
181
201
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facter
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.6
4
+ version: 2.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-26 00:00:00.000000000 Z
11
+ date: 2020-01-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: You can prove anything with facts!
14
14
  email: info@puppetlabs.com
@@ -20,7 +20,6 @@ files:
20
20
  - COMMITTERS.md
21
21
  - CONTRIBUTING.md
22
22
  - Gemfile
23
- - Gemfile.lock
24
23
  - LICENSE
25
24
  - README.md
26
25
  - Rakefile
@@ -336,9 +335,11 @@ files:
336
335
  - spec/fixtures/unit/util/ip/linux_2_6_35_proc_net_bonding_bond0
337
336
  - spec/fixtures/unit/util/ip/linux_get_single_interface_eth0
338
337
  - spec/fixtures/unit/util/ip/linux_get_single_interface_ib0
338
+ - spec/fixtures/unit/util/ip/linux_get_single_interface_ib0_centos7
339
339
  - spec/fixtures/unit/util/ip/linux_get_single_interface_lo
340
340
  - spec/fixtures/unit/util/ip/linux_ifconfig_all_with_single_interface
341
341
  - spec/fixtures/unit/util/ip/linux_ifconfig_ib0
342
+ - spec/fixtures/unit/util/ip/linux_ifconfig_ib0_centos7
342
343
  - spec/fixtures/unit/util/ip/solaris_ifconfig_all_with_multiple_interfaces
343
344
  - spec/fixtures/unit/util/ip/solaris_ifconfig_single_interface
344
345
  - spec/fixtures/unit/util/ip/windows_netsh_all_interfaces
@@ -532,7 +533,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
532
533
  - !ruby/object:Gem::Version
533
534
  version: '0'
534
535
  requirements: []
535
- rubygems_version: 3.0.4
536
+ rubygems_version: 3.1.2
536
537
  signing_key:
537
538
  specification_version: 4
538
539
  summary: Facter, a system inventory tool
@@ -685,9 +686,11 @@ test_files:
685
686
  - spec/fixtures/unit/util/ip/linux_2_6_35_proc_net_bonding_bond0
686
687
  - spec/fixtures/unit/util/ip/linux_get_single_interface_eth0
687
688
  - spec/fixtures/unit/util/ip/linux_get_single_interface_ib0
689
+ - spec/fixtures/unit/util/ip/linux_get_single_interface_ib0_centos7
688
690
  - spec/fixtures/unit/util/ip/linux_get_single_interface_lo
689
691
  - spec/fixtures/unit/util/ip/linux_ifconfig_all_with_single_interface
690
692
  - spec/fixtures/unit/util/ip/linux_ifconfig_ib0
693
+ - spec/fixtures/unit/util/ip/linux_ifconfig_ib0_centos7
691
694
  - spec/fixtures/unit/util/ip/solaris_ifconfig_all_with_multiple_interfaces
692
695
  - spec/fixtures/unit/util/ip/solaris_ifconfig_single_interface
693
696
  - spec/fixtures/unit/util/ip/windows_netsh_all_interfaces
@@ -1,79 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- facter (2.5.4)
5
- redcarpet (<= 2.3.0)
6
- watchr
7
- yard
8
-
9
- GEM
10
- remote: https://artifactory.delivery.puppetlabs.net/artifactory/api/gems/rubygems/
11
- specs:
12
- CFPropertyList (2.3.6)
13
- addressable (2.3.8)
14
- artifactory (3.0.0)
15
- builder (3.2.3)
16
- coderay (1.1.2)
17
- diff-lcs (1.1.3)
18
- json (1.8.6)
19
- json-schema (2.6.2)
20
- addressable (~> 2.3.8)
21
- metaclass (0.0.4)
22
- method_source (0.9.2)
23
- mocha (0.10.5)
24
- metaclass (~> 0.0.1)
25
- packaging (0.99.0)
26
- artifactory
27
- rake
28
- pry (0.12.2)
29
- coderay (~> 1.1.0)
30
- method_source (~> 0.9.0)
31
- puppet-lint (2.3.6)
32
- puppet-syntax (2.5.0)
33
- rake
34
- puppetlabs_spec_helper (1.1.1)
35
- mocha
36
- puppet-lint
37
- puppet-syntax
38
- rake
39
- rspec-puppet
40
- rake (10.1.1)
41
- redcarpet (2.3.0)
42
- rspec (2.11.0)
43
- rspec-core (~> 2.11.0)
44
- rspec-expectations (~> 2.11.0)
45
- rspec-mocks (~> 2.11.0)
46
- rspec-core (2.11.1)
47
- rspec-expectations (2.11.3)
48
- diff-lcs (~> 1.1.3)
49
- rspec-mocks (2.11.3)
50
- rspec-puppet (2.7.5)
51
- rspec
52
- watchr (0.7)
53
- yard (0.9.20)
54
- yarjuf (1.0.5)
55
- builder
56
- rspec (>= 2.0)
57
-
58
- PLATFORMS
59
- ruby
60
-
61
- DEPENDENCIES
62
- CFPropertyList (~> 2.2)
63
- facter (>= 1.0.0)!
64
- ffi (~> 1.9.18)
65
- json (~> 1.7)
66
- json-schema (~> 2.6.2)
67
- mocha (~> 0.10.5)
68
- packaging (~> 0.99)
69
- pry
70
- puppetlabs_spec_helper
71
- rake (~> 10.1.0)
72
- redcarpet (<= 2.3.0)
73
- rspec (~> 2.11.0)
74
- watchr
75
- yard
76
- yarjuf (~> 1.0)
77
-
78
- BUNDLED WITH
79
- 1.17.1