ohai 8.22.1 → 8.23.0

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ohai/application.rb +2 -0
  3. data/lib/ohai/mixin/dmi_decode.rb +2 -0
  4. data/lib/ohai/mixin/ec2_metadata.rb +14 -0
  5. data/lib/ohai/plugins/azure.rb +5 -5
  6. data/lib/ohai/plugins/c.rb +118 -46
  7. data/lib/ohai/plugins/cloud.rb +1 -0
  8. data/lib/ohai/plugins/dmi.rb +5 -5
  9. data/lib/ohai/plugins/ec2.rb +1 -0
  10. data/lib/ohai/plugins/erlang.rb +3 -5
  11. data/lib/ohai/plugins/groovy.rb +1 -1
  12. data/lib/ohai/plugins/haskell.rb +4 -4
  13. data/lib/ohai/plugins/hostname.rb +6 -6
  14. data/lib/ohai/plugins/ip_scopes.rb +1 -1
  15. data/lib/ohai/plugins/linux/network.rb +15 -15
  16. data/lib/ohai/plugins/linux/platform.rb +82 -43
  17. data/lib/ohai/plugins/linux/sessions.rb +2 -0
  18. data/lib/ohai/plugins/linux/virtualization.rb +18 -0
  19. data/lib/ohai/plugins/lua.rb +1 -1
  20. data/lib/ohai/plugins/network.rb +10 -10
  21. data/lib/ohai/plugins/scala.rb +2 -2
  22. data/lib/ohai/plugins/solaris2/dmi.rb +5 -5
  23. data/lib/ohai/plugins/sysconf.rb +45 -0
  24. data/lib/ohai/plugins/virtualbox.rb +22 -17
  25. data/lib/ohai/plugins/vmware.rb +2 -2
  26. data/lib/ohai/plugins/windows/virtualization.rb +14 -0
  27. data/lib/ohai/system.rb +0 -4
  28. data/lib/ohai/util/file_helper.rb +2 -2
  29. data/lib/ohai/version.rb +1 -1
  30. data/spec/unit/plugins/c_spec.rb +299 -266
  31. data/spec/unit/plugins/cloud_spec.rb +6 -0
  32. data/spec/unit/plugins/ec2_spec.rb +45 -1
  33. data/spec/unit/plugins/erlang_spec.rb +5 -5
  34. data/spec/unit/plugins/linux/network_spec.rb +1 -1
  35. data/spec/unit/plugins/linux/platform_spec.rb +43 -1
  36. data/spec/unit/plugins/linux/virtualization_spec.rb +19 -0
  37. data/spec/unit/plugins/network_spec.rb +23 -23
  38. data/spec/unit/plugins/sysconf_spec.rb +679 -0
  39. data/spec/unit/plugins/windows/virtualization_spec.rb +67 -0
  40. data/spec/unit/system_spec.rb +0 -1
  41. metadata +5 -3
@@ -162,6 +162,12 @@ describe Ohai::System, "plugin cloud" do
162
162
  @plugin[:azure] = Mash.new()
163
163
  end
164
164
 
165
+ it "populates cloud private ip" do
166
+ @plugin[:azure]["private_ip"] = "10.0.0.1"
167
+ @plugin.run
168
+ expect(@plugin[:cloud][:private_ips][0]).to eq(@plugin[:azure]["private_ip"])
169
+ end
170
+
165
171
  it "populates cloud public ip" do
166
172
  @plugin[:azure]["public_ip"] = "174.129.150.8"
167
173
  @plugin.run
@@ -49,7 +49,7 @@ describe Ohai::System, "plugin ec2" do
49
49
  allow(t).to receive(:connect_nonblock).and_raise(Errno::EINPROGRESS)
50
50
  allow(Socket).to receive(:new).and_return(t)
51
51
  expect(@http_client).to receive(:get).
52
- with("/").twice.
52
+ with("/").exactly(3).times.
53
53
  and_return(double("Net::HTTP Response", :body => "2012-01-12", :code => "200"))
54
54
  end
55
55
 
@@ -71,6 +71,9 @@ describe Ohai::System, "plugin ec2" do
71
71
  expect(@http_client).to receive(:get).
72
72
  with("/2012-01-12/user-data/").
73
73
  and_return(double("Net::HTTP Response", :body => "By the pricking of my thumb...", :code => "200"))
74
+ expect(@http_client).to receive(:get).
75
+ with("/2012-01-12/dynamic/instance-identity/document/").
76
+ and_return(double("Net::HTTP Response", :body => "{\"accountId\":\"4815162342\"}", :code => "200"))
74
77
 
75
78
  plugin.run
76
79
 
@@ -89,6 +92,9 @@ describe Ohai::System, "plugin ec2" do
89
92
  expect(@http_client).to receive(:get).
90
93
  with("/2012-01-12/user-data/").
91
94
  and_return(double("Net::HTTP Response", :body => "^_<8B>^H^H<C7>U^@^Csomething^@KT<C8><C9>,)<C9>IU(I-.I<CB><CC>I<E5>^B^@^Qz<BF><B0>^R^@^@^@", :code => "200"))
95
+ expect(@http_client).to receive(:get).
96
+ with("/2012-01-12/dynamic/instance-identity/document/").
97
+ and_return(double("Net::HTTP Response", :body => "{\"accountId\":\"4815162342\"}", :code => "200"))
92
98
 
93
99
  plugin.run
94
100
 
@@ -98,6 +104,29 @@ describe Ohai::System, "plugin ec2" do
98
104
  expect(plugin[:ec2]["security_groups"]).to eql %w{group1 group2}
99
105
  expect(plugin[:ec2]["userdata"]).to eq(Base64.decode64("Xl88OEI+XkheSDxDNz5VXkBeQ3NvbWV0aGluZ15AS1Q8Qzg+PEM5PiwpPEM5\nPklVKEktLkk8Q0I+PENDPkk8RTU+XkJeQF5RejxCRj48QjA+XlJeQF5AXkA="))
100
106
  end
107
+
108
+ it "fetches AWS account id" do
109
+ paths.each do |name, body|
110
+ expect(@http_client).to receive(:get).
111
+ with("/2012-01-12/#{name}").
112
+ and_return(double("Net::HTTP Response", :body => body, :code => "200"))
113
+ end
114
+ expect(@http_client).to receive(:get).
115
+ with("/2012-01-12/user-data/").
116
+ and_return(double("Net::HTTP Response", :body => "^_<8B>^H^H<C7>U^@^Csomething^@KT<C8><C9>,)<C9>IU(I-.I<CB><CC>I<E5>^B^@^Qz<BF><B0>^R^@^@^@", :code => "200"))
117
+ expect(@http_client).to receive(:get).
118
+ with("/2012-01-12/dynamic/instance-identity/document/").
119
+ and_return(double("Net::HTTP Response", :body => "{\"accountId\":\"4815162342\"}", :code => "200"))
120
+
121
+ plugin.run
122
+
123
+ expect(plugin[:ec2]).not_to be_nil
124
+ expect(plugin[:ec2]["instance_type"]).to eq("c1.medium")
125
+ expect(plugin[:ec2]["ami_id"]).to eq("ami-5d2dc934")
126
+ expect(plugin[:ec2]["security_groups"]).to eql %w{group1 group2}
127
+ expect(plugin[:ec2]["account_id"]).to eq("4815162342")
128
+ end
129
+
101
130
  end
102
131
 
103
132
  it "parses ec2 network/ directory as a multi-level hash" do
@@ -122,6 +151,9 @@ describe Ohai::System, "plugin ec2" do
122
151
  expect(@http_client).to receive(:get).
123
152
  with("/2012-01-12/user-data/").
124
153
  and_return(double("Net::HTTP Response", :body => "By the pricking of my thumb...", :code => "200"))
154
+ expect(@http_client).to receive(:get).
155
+ with("/2012-01-12/dynamic/instance-identity/document/").
156
+ and_return(double("Net::HTTP Response", :body => "{\"accountId\":\"4815162342\"}", :code => "200"))
125
157
 
126
158
  plugin.run
127
159
 
@@ -150,6 +182,9 @@ describe Ohai::System, "plugin ec2" do
150
182
  expect(@http_client).to receive(:get).
151
183
  with("/2012-01-12/user-data/").
152
184
  and_return(double("Net::HTTP Response", :body => "By the pricking of my thumb...", :code => "200"))
185
+ expect(@http_client).to receive(:get).
186
+ with("/2012-01-12/dynamic/instance-identity/document/").
187
+ and_return(double("Net::HTTP Response", :body => "{\"accountId\":\"4815162342\"}", :code => "200"))
153
188
 
154
189
  plugin.run
155
190
 
@@ -180,6 +215,9 @@ describe Ohai::System, "plugin ec2" do
180
215
  expect(@http_client).to receive(:get).
181
216
  with("/2012-01-12/user-data/").
182
217
  and_return(double("Net::HTTP Response", :body => "By the pricking of my thumb...", :code => "200"))
218
+ expect(@http_client).to receive(:get).
219
+ with("/2012-01-12/dynamic/instance-identity/document/").
220
+ and_return(double("Net::HTTP Response", :body => "{\"accountId\":\"4815162342\"}", :code => "200"))
183
221
 
184
222
  plugin.run
185
223
 
@@ -219,6 +257,9 @@ describe Ohai::System, "plugin ec2" do
219
257
  expect(@http_client).to receive(:get).
220
258
  with("/2012-01-12/user-data/").
221
259
  and_return(double("Net::HTTP Response", :body => "By the pricking of my thumb...", :code => "200"))
260
+ expect(@http_client).to receive(:get).
261
+ with("/2012-01-12/dynamic/instance-identity/document/").
262
+ and_return(double("Net::HTTP Response", :body => "{\"accountId\":\"4815162342\"}", :code => "200"))
222
263
 
223
264
  plugin.run
224
265
 
@@ -238,6 +279,9 @@ describe Ohai::System, "plugin ec2" do
238
279
  expect(@http_client).to receive(:get).
239
280
  with("/2012-01-12/user-data/").
240
281
  and_return(double("Net::HTTP Response", :body => "By the pricking of my thumb...", :code => "200"))
282
+ expect(@http_client).to receive(:get).
283
+ with("/2012-01-12/dynamic/instance-identity/document/").
284
+ and_return(double("Net::HTTP Response", :body => "{\"accountId\":\"4815162342\"}", :code => "200"))
241
285
 
242
286
  plugin.run
243
287
 
@@ -25,10 +25,10 @@ describe Ohai::System, "plugin erlang" do
25
25
  before(:each) do
26
26
  plugin[:languages] = Mash.new
27
27
  erl_v_output = "Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 7.3\n"
28
- erl_systeminfo_output = "\"18\"\r\n\"7.3\"\r\n\"2.10\"\r\n"
28
+ erl_systeminfo_output = "19.1,8.1,2.11"
29
29
  allow(plugin).to receive(:shell_out).with("erl +V")
30
30
  .and_return(mock_shell_out(0, "", erl_v_output))
31
- allow(plugin).to receive(:shell_out).with("erl -eval 'erlang:display(erlang:system_info(otp_release)), erlang:display(erlang:system_info(version)), erlang:display(erlang:system_info(nif_version)), halt().' -noshell")
31
+ allow(plugin).to receive(:shell_out).with("erl -eval '{ok, Ver} = file:read_file(filename:join([code:root_dir(), \"releases\", erlang:system_info(otp_release), \"OTP_VERSION\"])), Vsn = binary:bin_to_list(Ver, {0, byte_size(Ver) - 1}), io:format(\"~s,~s,~s\", [Vsn, erlang:system_info(version), erlang:system_info(nif_version)]), halt().' -noshell")
32
32
  .and_return(mock_shell_out(0, erl_systeminfo_output, ""))
33
33
  end
34
34
 
@@ -44,17 +44,17 @@ describe Ohai::System, "plugin erlang" do
44
44
 
45
45
  it "sets languages[:erlang][:version]" do
46
46
  plugin.run
47
- expect(plugin.languages[:erlang][:version]).to eql("18")
47
+ expect(plugin.languages[:erlang][:version]).to eql("19.1")
48
48
  end
49
49
 
50
50
  it "sets languages[:erlang][:erts_version]" do
51
51
  plugin.run
52
- expect(plugin.languages[:erlang][:erts_version]).to eql("7.3")
52
+ expect(plugin.languages[:erlang][:erts_version]).to eql("8.1")
53
53
  end
54
54
 
55
55
  it "sets languages[:erlang][:nif_version]" do
56
56
  plugin.run
57
- expect(plugin.languages[:erlang][:nif_version]).to eql("2.10")
57
+ expect(plugin.languages[:erlang][:nif_version]).to eql("2.11")
58
58
  end
59
59
 
60
60
  it "does not set languages[:erlang] if the erl commands fails" do
@@ -1325,7 +1325,7 @@ EOM
1325
1325
  end
1326
1326
 
1327
1327
  it "logs a message and skips previously unseen interfaces in 'ip route show'" do
1328
- expect(Ohai::Log).to receive(:debug).with("Skipping previously unseen interface from 'ip route show': virbr0").once
1328
+ expect(Ohai::Log).to receive(:debug).with(/Skipping previously unseen interface from 'ip route show': virbr0/).once
1329
1329
  allow(Ohai::Log).to receive(:debug) # Catches the 'Loading plugin network' type messages
1330
1330
  plugin.run
1331
1331
  end
@@ -16,7 +16,6 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
20
19
  require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
21
20
 
22
21
  describe Ohai::System, "Linux plugin platform" do
@@ -37,6 +36,7 @@ describe Ohai::System, "Linux plugin platform" do
37
36
  let(:have_raspi_config) { false }
38
37
  let(:have_os_release) { false }
39
38
  let(:have_cisco_release) { false }
39
+ let(:have_cumulus_dir) { false }
40
40
 
41
41
  before(:each) do
42
42
  @plugin = get_plugin("linux/platform")
@@ -58,6 +58,7 @@ describe Ohai::System, "Linux plugin platform" do
58
58
  allow(File).to receive(:exist?).with("/usr/bin/raspi-config").and_return(have_raspi_config)
59
59
  allow(File).to receive(:exist?).with("/etc/os-release").and_return(have_os_release)
60
60
  allow(File).to receive(:exist?).with("/etc/shared/os-release").and_return(have_cisco_release)
61
+ allow(Dir).to receive(:exist?).with("/etc/cumulus").and_return(have_cumulus_dir)
61
62
 
62
63
  allow(File).to receive(:read).with("PLEASE STUB ALL File.read CALLS")
63
64
  end
@@ -171,6 +172,41 @@ describe Ohai::System, "Linux plugin platform" do
171
172
  expect(@plugin[:platform_family]).to eq("debian")
172
173
  end
173
174
  end
175
+
176
+ context "on cumulus" do
177
+
178
+ let(:have_cumulus_dir) { true }
179
+ let(:cumulus_release_content) do
180
+ <<-OS_RELEASE
181
+ NAME="Cumulus Linux"
182
+ VERSION_ID=3.1.2
183
+ VERSION="Cumulus Linux 3.1.2"
184
+ PRETTY_NAME="Cumulus Linux"
185
+ ID=cumulus-linux
186
+ ID_LIKE=debian
187
+ CPE_NAME=cpe:/o:cumulusnetworks:cumulus_linux:3.1.2
188
+ HOME_URL="http://www.cumulusnetworks.com/"
189
+ SUPPORT_URL="http://support.cumulusnetworks.com/"
190
+
191
+ OS_RELEASE
192
+ end
193
+
194
+ before(:each) do
195
+ expect(File).to receive(:read).with("/etc/cumulus/etc.replace/os-release").and_return(cumulus_release_content)
196
+ end
197
+
198
+ # Cumulus is a debian derivative
199
+ it "should detect Cumulus as itself with debian as the family" do
200
+ @plugin.run
201
+ expect(@plugin[:platform]).to eq("cumulus")
202
+ expect(@plugin[:platform_family]).to eq("debian")
203
+ end
204
+
205
+ it "should detect Cumulus platform_version" do
206
+ @plugin.run
207
+ expect(@plugin[:platform_version]).to eq("3.1.2")
208
+ end
209
+ end
174
210
  end
175
211
 
176
212
  describe "on slackware" do
@@ -187,6 +223,12 @@ describe Ohai::System, "Linux plugin platform" do
187
223
  expect(@plugin[:platform]).to eq("slackware")
188
224
  expect(@plugin[:platform_family]).to eq("slackware")
189
225
  end
226
+
227
+ it "should set platform_version on slackware" do
228
+ expect(File).to receive(:read).with("/etc/slackware-version").and_return("Slackware 12.0.0")
229
+ @plugin.run
230
+ expect(@plugin[:platform_version]).to eq("12.0.0")
231
+ end
190
232
  end
191
233
 
192
234
  describe "on arch" do
@@ -345,6 +345,25 @@ OUTPUT
345
345
  expect(plugin[:virtualization][:systems][:bhyve]).to eq("guest")
346
346
  end
347
347
 
348
+ it "sets veertu guest if dmidecode detects Veertu" do
349
+ veertu_dmidecode = <<-VEERTU
350
+ System Information
351
+ Manufacturer: Veertu
352
+ Product Name: Veertu
353
+ Version: Not Specified
354
+ Serial Number: Not Specified
355
+ UUID: Not Settable
356
+ Wake-up Type: Power Switch
357
+ SKU Number: Not Specified
358
+ Family: Not Specified
359
+ VEERTU
360
+ allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, veertu_dmidecode, ""))
361
+ plugin.run
362
+ expect(plugin[:virtualization][:system]).to eq("veertu")
363
+ expect(plugin[:virtualization][:role]).to eq("guest")
364
+ expect(plugin[:virtualization][:systems][:veertu]).to eq("guest")
365
+ end
366
+
348
367
  it "should run dmidecode and not set virtualization if nothing is detected" do
349
368
  allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, "", ""))
350
369
  plugin.run
@@ -367,7 +367,7 @@ describe Ohai::System, "Network Plugin" do
367
367
  end
368
368
 
369
369
  it "informs about this setup" do
370
- expect(Ohai::Log).to receive(:debug).with(/^ipaddress and ip6address are set from different interfaces/)
370
+ expect(Ohai::Log).to receive(:debug).with(/ipaddress and ip6address are set from different interfaces/)
371
371
  allow(Ohai::Log).to receive(:debug)
372
372
  @plugin.run
373
373
  end
@@ -396,7 +396,7 @@ describe Ohai::System, "Network Plugin" do
396
396
  end
397
397
 
398
398
  it "informs about this setup" do
399
- expect(Ohai::Log).to receive(:debug).with(/^ipaddress and ip6address are set from different interfaces/)
399
+ expect(Ohai::Log).to receive(:debug).with(/ipaddress and ip6address are set from different interfaces/)
400
400
  allow(Ohai::Log).to receive(:debug)
401
401
  @plugin.run
402
402
  end
@@ -421,8 +421,8 @@ describe Ohai::System, "Network Plugin" do
421
421
  end
422
422
 
423
423
  it "warns about this conflict" do
424
- expect(Ohai::Log).to receive(:debug).with(/^\[inet\] no ipaddress\/mask on eth1/).once
425
- expect(Ohai::Log).to receive(:debug).with(/^\[inet6\] no ipaddress\/mask on eth1/).once
424
+ expect(Ohai::Log).to receive(:debug).with(/\[inet\] no ipaddress\/mask on eth1/).once
425
+ expect(Ohai::Log).to receive(:debug).with(/\[inet6\] no ipaddress\/mask on eth1/).once
426
426
  allow(Ohai::Log).to receive(:debug)
427
427
  @plugin.run
428
428
  end
@@ -460,11 +460,11 @@ describe Ohai::System, "Network Plugin" do
460
460
  end
461
461
 
462
462
  it "warns about this conflict" do
463
- expect(Ohai::Log).to receive(:warn).with(/^unable to detect ipaddress/).once
464
- expect(Ohai::Log).to receive(:warn).with(/^\[inet\] no ip address on eth0/).once
465
- expect(Ohai::Log).to receive(:debug).with(/^unable to detect ip6address/).once
466
- expect(Ohai::Log).to receive(:debug).with(/^unable to detect macaddress/).twice # for each family
467
- expect(Ohai::Log).to receive(:warn).with(/^\[inet6\] no ip address on eth0/).once
463
+ expect(Ohai::Log).to receive(:warn).with(/unable to detect ipaddress/).once
464
+ expect(Ohai::Log).to receive(:warn).with(/\[inet\] no ip address on eth0/).once
465
+ expect(Ohai::Log).to receive(:debug).with(/unable to detect ip6address/).once
466
+ expect(Ohai::Log).to receive(:debug).with(/unable to detect macaddress/).twice # for each family
467
+ expect(Ohai::Log).to receive(:warn).with(/\[inet6\] no ip address on eth0/).once
468
468
  @plugin.run
469
469
  end
470
470
  end
@@ -491,9 +491,9 @@ describe Ohai::System, "Network Plugin" do
491
491
  end
492
492
 
493
493
  it "should warn about it" do
494
- expect(Ohai::Log).to receive(:warn).with(/^unable to detect ipaddress/).once
495
- expect(Ohai::Log).to receive(:debug).with(/^unable to detect macaddress/).twice # for each family
496
- expect(Ohai::Log).to receive(:debug).with(/^unable to detect ip6address/).once
494
+ expect(Ohai::Log).to receive(:warn).with(/unable to detect ipaddress/).once
495
+ expect(Ohai::Log).to receive(:debug).with(/unable to detect macaddress/).twice # for each family
496
+ expect(Ohai::Log).to receive(:debug).with(/unable to detect ip6address/).once
497
497
  @plugin.run
498
498
  end
499
499
  end
@@ -643,8 +643,8 @@ describe Ohai::System, "Network Plugin" do
643
643
  it_populates_ipaddress_attributes
644
644
 
645
645
  it "picks {ip,mac,ip6}address from the first interface" do
646
- expect(Ohai::Log).to receive(:debug).with(/^\[inet\] no default interface/).once
647
- expect(Ohai::Log).to receive(:debug).with(/^\[inet6\] no default interface/).once
646
+ expect(Ohai::Log).to receive(:debug).with(/\[inet\] no default interface/).once
647
+ expect(Ohai::Log).to receive(:debug).with(/\[inet6\] no default interface/).once
648
648
  allow(Ohai::Log).to receive(:debug)
649
649
  @plugin.run
650
650
  expect(@plugin["ipaddress"]).to eq("192.168.99.11")
@@ -666,8 +666,8 @@ describe Ohai::System, "Network Plugin" do
666
666
  it_populates_ipaddress_attributes
667
667
 
668
668
  it "prefers global scope addressses to set {ip,mac,ip6}address" do
669
- expect(Ohai::Log).to receive(:debug).with(/^\[inet\] no default interface/).once
670
- expect(Ohai::Log).to receive(:debug).with(/^\[inet6\] no default interface/).once
669
+ expect(Ohai::Log).to receive(:debug).with(/\[inet\] no default interface/).once
670
+ expect(Ohai::Log).to receive(:debug).with(/\[inet6\] no default interface/).once
671
671
  allow(Ohai::Log).to receive(:debug)
672
672
  @plugin.run
673
673
  expect(@plugin["ipaddress"]).to eq("192.168.99.11")
@@ -795,10 +795,10 @@ describe Ohai::System, "Network Plugin" do
795
795
  end
796
796
 
797
797
  it "warns about not being able to set {ip,mac}address (ipv4)" do
798
- expect(Ohai::Log).to receive(:warn).with(/^unable to detect ipaddress/).once
799
- expect(Ohai::Log).to receive(:debug).with(/^unable to detect macaddress/) # for ipv4
800
- expect(Ohai::Log).to receive(:debug).with(/^setting macaddress to/) # for ipv6
801
- expect(Ohai::Log).to receive(:debug).with(/^\[inet6\] Using default interface eth0 and default gateway/) # for ipv6
798
+ expect(Ohai::Log).to receive(:warn).with(/unable to detect ipaddress/).once
799
+ expect(Ohai::Log).to receive(:debug).with(/unable to detect macaddress/) # for ipv4
800
+ expect(Ohai::Log).to receive(:debug).with(/setting macaddress to/) # for ipv6
801
+ expect(Ohai::Log).to receive(:debug).with(/\[inet6\] Using default interface eth0 and default gateway/) # for ipv6
802
802
  @plugin.run
803
803
  end
804
804
 
@@ -810,7 +810,7 @@ describe Ohai::System, "Network Plugin" do
810
810
  end
811
811
 
812
812
  it "informs about macaddress being set using the ipv6 setup" do
813
- expect(Ohai::Log).to receive(:debug).with(/^setting macaddress to '00:16:3E:2F:36:79'/)
813
+ expect(Ohai::Log).to receive(:debug).with(/setting macaddress to '00:16:3E:2F:36:79'/)
814
814
  allow(Ohai::Log).to receive(:debug)
815
815
  @plugin.run
816
816
  end
@@ -842,7 +842,7 @@ describe Ohai::System, "Network Plugin" do
842
842
  end
843
843
 
844
844
  it "informs about macaddress being set using the ipv6 setup" do
845
- expect(Ohai::Log).to receive(:debug).with(/^setting macaddress to '00:16:3E:2F:36:79'/)
845
+ expect(Ohai::Log).to receive(:debug).with(/setting macaddress to '00:16:3E:2F:36:79'/)
846
846
  allow(Ohai::Log).to receive(:debug)
847
847
  @plugin.run
848
848
  end
@@ -962,7 +962,7 @@ describe Ohai::System, "Network Plugin" do
962
962
  end
963
963
 
964
964
  it "warns about not being able to set ipaddress" do
965
- expect(Ohai::Log).to receive(:warn).with(/^unable to detect ipaddress/).once
965
+ expect(Ohai::Log).to receive(:warn).with(/unable to detect ipaddress/).once
966
966
  @plugin.run
967
967
  end
968
968
 
@@ -0,0 +1,679 @@
1
+ #
2
+ # Author:: Davide Cavalca <dcavalca@fb.com>
3
+ # Copyright:: Copyright (c) 2016 Facebook
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
20
+
21
+ describe Ohai::System, "sysconf plugin", :unix_only do
22
+ let(:plugin) { get_plugin("sysconf") }
23
+
24
+ it "should populate sysconf if getconf is found" do
25
+ getconf_out = <<-GETCONF_OUT
26
+ LINK_MAX 65000
27
+ _POSIX_LINK_MAX 65000
28
+ MAX_CANON 255
29
+ _POSIX_MAX_CANON 255
30
+ MAX_INPUT 255
31
+ _POSIX_MAX_INPUT 255
32
+ NAME_MAX 255
33
+ _POSIX_NAME_MAX 255
34
+ PATH_MAX 4096
35
+ _POSIX_PATH_MAX 4096
36
+ PIPE_BUF 4096
37
+ _POSIX_PIPE_BUF 4096
38
+ SOCK_MAXBUF
39
+ _POSIX_ASYNC_IO
40
+ _POSIX_CHOWN_RESTRICTED 1
41
+ _POSIX_NO_TRUNC 1
42
+ _POSIX_PRIO_IO
43
+ _POSIX_SYNC_IO
44
+ _POSIX_VDISABLE 0
45
+ ARG_MAX 2097152
46
+ ATEXIT_MAX 2147483647
47
+ CHAR_BIT 8
48
+ CHAR_MAX 127
49
+ CHAR_MIN -128
50
+ CHILD_MAX 63672
51
+ CLK_TCK 100
52
+ INT_MAX 2147483647
53
+ INT_MIN -2147483648
54
+ IOV_MAX 1024
55
+ LOGNAME_MAX 256
56
+ LONG_BIT 64
57
+ MB_LEN_MAX 16
58
+ NGROUPS_MAX 65536
59
+ NL_ARGMAX 4096
60
+ NL_LANGMAX 2048
61
+ NL_MSGMAX 2147483647
62
+ NL_NMAX 2147483647
63
+ NL_SETMAX 2147483647
64
+ NL_TEXTMAX 2147483647
65
+ NSS_BUFLEN_GROUP 1024
66
+ NSS_BUFLEN_PASSWD 1024
67
+ NZERO 20
68
+ OPEN_MAX 1024
69
+ PAGESIZE 4096
70
+ PAGE_SIZE 4096
71
+ PASS_MAX 8192
72
+ PTHREAD_DESTRUCTOR_ITERATIONS 4
73
+ PTHREAD_KEYS_MAX 1024
74
+ PTHREAD_STACK_MIN 16384
75
+ PTHREAD_THREADS_MAX
76
+ SCHAR_MAX 127
77
+ SCHAR_MIN -128
78
+ SHRT_MAX 32767
79
+ SHRT_MIN -32768
80
+ SSIZE_MAX 32767
81
+ TTY_NAME_MAX 32
82
+ TZNAME_MAX 6
83
+ UCHAR_MAX 255
84
+ UINT_MAX 4294967295
85
+ UIO_MAXIOV 1024
86
+ ULONG_MAX 18446744073709551615
87
+ USHRT_MAX 65535
88
+ WORD_BIT 32
89
+ _AVPHYS_PAGES 2101393
90
+ _NPROCESSORS_CONF 8
91
+ _NPROCESSORS_ONLN 8
92
+ _PHYS_PAGES 4096040
93
+ _POSIX_ARG_MAX 2097152
94
+ _POSIX_ASYNCHRONOUS_IO 200809
95
+ _POSIX_CHILD_MAX 63672
96
+ _POSIX_FSYNC 200809
97
+ _POSIX_JOB_CONTROL 1
98
+ _POSIX_MAPPED_FILES 200809
99
+ _POSIX_MEMLOCK 200809
100
+ _POSIX_MEMLOCK_RANGE 200809
101
+ _POSIX_MEMORY_PROTECTION 200809
102
+ _POSIX_MESSAGE_PASSING 200809
103
+ _POSIX_NGROUPS_MAX 65536
104
+ _POSIX_OPEN_MAX 1024
105
+ _POSIX_PII
106
+ _POSIX_PII_INTERNET
107
+ _POSIX_PII_INTERNET_DGRAM
108
+ _POSIX_PII_INTERNET_STREAM
109
+ _POSIX_PII_OSI
110
+ _POSIX_PII_OSI_CLTS
111
+ _POSIX_PII_OSI_COTS
112
+ _POSIX_PII_OSI_M
113
+ _POSIX_PII_SOCKET
114
+ _POSIX_PII_XTI
115
+ _POSIX_POLL
116
+ _POSIX_PRIORITIZED_IO 200809
117
+ _POSIX_PRIORITY_SCHEDULING 200809
118
+ _POSIX_REALTIME_SIGNALS 200809
119
+ _POSIX_SAVED_IDS 1
120
+ _POSIX_SELECT
121
+ _POSIX_SEMAPHORES 200809
122
+ _POSIX_SHARED_MEMORY_OBJECTS 200809
123
+ _POSIX_SSIZE_MAX 32767
124
+ _POSIX_STREAM_MAX 16
125
+ _POSIX_SYNCHRONIZED_IO 200809
126
+ _POSIX_THREADS 200809
127
+ _POSIX_THREAD_ATTR_STACKADDR 200809
128
+ _POSIX_THREAD_ATTR_STACKSIZE 200809
129
+ _POSIX_THREAD_PRIORITY_SCHEDULING 200809
130
+ _POSIX_THREAD_PRIO_INHERIT 200809
131
+ _POSIX_THREAD_PRIO_PROTECT 200809
132
+ _POSIX_THREAD_ROBUST_PRIO_INHERIT
133
+ _POSIX_THREAD_ROBUST_PRIO_PROTECT
134
+ _POSIX_THREAD_PROCESS_SHARED 200809
135
+ _POSIX_THREAD_SAFE_FUNCTIONS 200809
136
+ _POSIX_TIMERS 200809
137
+ TIMER_MAX
138
+ _POSIX_TZNAME_MAX 6
139
+ _POSIX_VERSION 200809
140
+ _T_IOV_MAX
141
+ _XOPEN_CRYPT 1
142
+ _XOPEN_ENH_I18N 1
143
+ _XOPEN_LEGACY 1
144
+ _XOPEN_REALTIME 1
145
+ _XOPEN_REALTIME_THREADS 1
146
+ _XOPEN_SHM 1
147
+ _XOPEN_UNIX 1
148
+ _XOPEN_VERSION 700
149
+ _XOPEN_XCU_VERSION 4
150
+ _XOPEN_XPG2 1
151
+ _XOPEN_XPG3 1
152
+ _XOPEN_XPG4 1
153
+ BC_BASE_MAX 99
154
+ BC_DIM_MAX 2048
155
+ BC_SCALE_MAX 99
156
+ BC_STRING_MAX 1000
157
+ CHARCLASS_NAME_MAX 2048
158
+ COLL_WEIGHTS_MAX 255
159
+ EQUIV_CLASS_MAX
160
+ EXPR_NEST_MAX 32
161
+ LINE_MAX 2048
162
+ POSIX2_BC_BASE_MAX 99
163
+ POSIX2_BC_DIM_MAX 2048
164
+ POSIX2_BC_SCALE_MAX 99
165
+ POSIX2_BC_STRING_MAX 1000
166
+ POSIX2_CHAR_TERM 200809
167
+ POSIX2_COLL_WEIGHTS_MAX 255
168
+ POSIX2_C_BIND 200809
169
+ POSIX2_C_DEV 200809
170
+ POSIX2_C_VERSION 200809
171
+ POSIX2_EXPR_NEST_MAX 32
172
+ POSIX2_FORT_DEV
173
+ POSIX2_FORT_RUN
174
+ _POSIX2_LINE_MAX 2048
175
+ POSIX2_LINE_MAX 2048
176
+ POSIX2_LOCALEDEF 200809
177
+ POSIX2_RE_DUP_MAX 32767
178
+ POSIX2_SW_DEV 200809
179
+ POSIX2_UPE
180
+ POSIX2_VERSION 200809
181
+ RE_DUP_MAX 32767
182
+ PATH /bin:/usr/bin
183
+ CS_PATH /bin:/usr/bin
184
+ LFS_CFLAGS
185
+ LFS_LDFLAGS
186
+ LFS_LIBS
187
+ LFS_LINTFLAGS
188
+ LFS64_CFLAGS -D_LARGEFILE64_SOURCE
189
+ LFS64_LDFLAGS
190
+ LFS64_LIBS
191
+ LFS64_LINTFLAGS -D_LARGEFILE64_SOURCE
192
+ _XBS5_WIDTH_RESTRICTED_ENVS XBS5_LP64_OFF64
193
+ XBS5_WIDTH_RESTRICTED_ENVS XBS5_LP64_OFF64
194
+ _XBS5_ILP32_OFF32
195
+ XBS5_ILP32_OFF32_CFLAGS
196
+ XBS5_ILP32_OFF32_LDFLAGS
197
+ XBS5_ILP32_OFF32_LIBS
198
+ XBS5_ILP32_OFF32_LINTFLAGS
199
+ _XBS5_ILP32_OFFBIG
200
+ XBS5_ILP32_OFFBIG_CFLAGS
201
+ XBS5_ILP32_OFFBIG_LDFLAGS
202
+ XBS5_ILP32_OFFBIG_LIBS
203
+ XBS5_ILP32_OFFBIG_LINTFLAGS
204
+ _XBS5_LP64_OFF64 1
205
+ XBS5_LP64_OFF64_CFLAGS -m64
206
+ XBS5_LP64_OFF64_LDFLAGS -m64
207
+ XBS5_LP64_OFF64_LIBS
208
+ XBS5_LP64_OFF64_LINTFLAGS
209
+ _XBS5_LPBIG_OFFBIG
210
+ XBS5_LPBIG_OFFBIG_CFLAGS
211
+ XBS5_LPBIG_OFFBIG_LDFLAGS
212
+ XBS5_LPBIG_OFFBIG_LIBS
213
+ XBS5_LPBIG_OFFBIG_LINTFLAGS
214
+ _POSIX_V6_ILP32_OFF32
215
+ POSIX_V6_ILP32_OFF32_CFLAGS
216
+ POSIX_V6_ILP32_OFF32_LDFLAGS
217
+ POSIX_V6_ILP32_OFF32_LIBS
218
+ POSIX_V6_ILP32_OFF32_LINTFLAGS
219
+ _POSIX_V6_WIDTH_RESTRICTED_ENVS POSIX_V6_LP64_OFF64
220
+ POSIX_V6_WIDTH_RESTRICTED_ENVS POSIX_V6_LP64_OFF64
221
+ _POSIX_V6_ILP32_OFFBIG
222
+ POSIX_V6_ILP32_OFFBIG_CFLAGS
223
+ POSIX_V6_ILP32_OFFBIG_LDFLAGS
224
+ POSIX_V6_ILP32_OFFBIG_LIBS
225
+ POSIX_V6_ILP32_OFFBIG_LINTFLAGS
226
+ _POSIX_V6_LP64_OFF64 1
227
+ POSIX_V6_LP64_OFF64_CFLAGS -m64
228
+ POSIX_V6_LP64_OFF64_LDFLAGS -m64
229
+ POSIX_V6_LP64_OFF64_LIBS
230
+ POSIX_V6_LP64_OFF64_LINTFLAGS
231
+ _POSIX_V6_LPBIG_OFFBIG
232
+ POSIX_V6_LPBIG_OFFBIG_CFLAGS
233
+ POSIX_V6_LPBIG_OFFBIG_LDFLAGS
234
+ POSIX_V6_LPBIG_OFFBIG_LIBS
235
+ POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
236
+ _POSIX_V7_ILP32_OFF32
237
+ POSIX_V7_ILP32_OFF32_CFLAGS
238
+ POSIX_V7_ILP32_OFF32_LDFLAGS
239
+ POSIX_V7_ILP32_OFF32_LIBS
240
+ POSIX_V7_ILP32_OFF32_LINTFLAGS
241
+ _POSIX_V7_WIDTH_RESTRICTED_ENVS POSIX_V7_LP64_OFF64
242
+ POSIX_V7_WIDTH_RESTRICTED_ENVS POSIX_V7_LP64_OFF64
243
+ _POSIX_V7_ILP32_OFFBIG
244
+ POSIX_V7_ILP32_OFFBIG_CFLAGS
245
+ POSIX_V7_ILP32_OFFBIG_LDFLAGS
246
+ POSIX_V7_ILP32_OFFBIG_LIBS
247
+ POSIX_V7_ILP32_OFFBIG_LINTFLAGS
248
+ _POSIX_V7_LP64_OFF64 1
249
+ POSIX_V7_LP64_OFF64_CFLAGS -m64
250
+ POSIX_V7_LP64_OFF64_LDFLAGS -m64
251
+ POSIX_V7_LP64_OFF64_LIBS
252
+ POSIX_V7_LP64_OFF64_LINTFLAGS
253
+ _POSIX_V7_LPBIG_OFFBIG
254
+ POSIX_V7_LPBIG_OFFBIG_CFLAGS
255
+ POSIX_V7_LPBIG_OFFBIG_LDFLAGS
256
+ POSIX_V7_LPBIG_OFFBIG_LIBS
257
+ POSIX_V7_LPBIG_OFFBIG_LINTFLAGS
258
+ _POSIX_ADVISORY_INFO 200809
259
+ _POSIX_BARRIERS 200809
260
+ _POSIX_BASE
261
+ _POSIX_C_LANG_SUPPORT
262
+ _POSIX_C_LANG_SUPPORT_R
263
+ _POSIX_CLOCK_SELECTION 200809
264
+ _POSIX_CPUTIME 200809
265
+ _POSIX_THREAD_CPUTIME 200809
266
+ _POSIX_DEVICE_SPECIFIC
267
+ _POSIX_DEVICE_SPECIFIC_R
268
+ _POSIX_FD_MGMT
269
+ _POSIX_FIFO
270
+ _POSIX_PIPE
271
+ _POSIX_FILE_ATTRIBUTES
272
+ _POSIX_FILE_LOCKING
273
+ _POSIX_FILE_SYSTEM
274
+ _POSIX_MONOTONIC_CLOCK 200809
275
+ _POSIX_MULTI_PROCESS
276
+ _POSIX_SINGLE_PROCESS
277
+ _POSIX_NETWORKING
278
+ _POSIX_READER_WRITER_LOCKS 200809
279
+ _POSIX_SPIN_LOCKS 200809
280
+ _POSIX_REGEXP 1
281
+ _REGEX_VERSION
282
+ _POSIX_SHELL 1
283
+ _POSIX_SIGNALS
284
+ _POSIX_SPAWN 200809
285
+ _POSIX_SPORADIC_SERVER
286
+ _POSIX_THREAD_SPORADIC_SERVER
287
+ _POSIX_SYSTEM_DATABASE
288
+ _POSIX_SYSTEM_DATABASE_R
289
+ _POSIX_TIMEOUTS 200809
290
+ _POSIX_TYPED_MEMORY_OBJECTS
291
+ _POSIX_USER_GROUPS
292
+ _POSIX_USER_GROUPS_R
293
+ POSIX2_PBS
294
+ POSIX2_PBS_ACCOUNTING
295
+ POSIX2_PBS_LOCATE
296
+ POSIX2_PBS_TRACK
297
+ POSIX2_PBS_MESSAGE
298
+ SYMLOOP_MAX
299
+ STREAM_MAX 16
300
+ AIO_LISTIO_MAX
301
+ AIO_MAX
302
+ AIO_PRIO_DELTA_MAX 20
303
+ DELAYTIMER_MAX 2147483647
304
+ HOST_NAME_MAX 64
305
+ LOGIN_NAME_MAX 256
306
+ MQ_OPEN_MAX
307
+ MQ_PRIO_MAX 32768
308
+ _POSIX_DEVICE_IO
309
+ _POSIX_TRACE
310
+ _POSIX_TRACE_EVENT_FILTER
311
+ _POSIX_TRACE_INHERIT
312
+ _POSIX_TRACE_LOG
313
+ RTSIG_MAX 32
314
+ SEM_NSEMS_MAX
315
+ SEM_VALUE_MAX 2147483647
316
+ SIGQUEUE_MAX 63672
317
+ FILESIZEBITS 64
318
+ POSIX_ALLOC_SIZE_MIN 4096
319
+ POSIX_REC_INCR_XFER_SIZE
320
+ POSIX_REC_MAX_XFER_SIZE
321
+ POSIX_REC_MIN_XFER_SIZE 4096
322
+ POSIX_REC_XFER_ALIGN 4096
323
+ SYMLINK_MAX
324
+ GNU_LIBC_VERSION glibc 2.24
325
+ GNU_LIBPTHREAD_VERSION NPTL 2.24
326
+ POSIX2_SYMLINKS 1
327
+ LEVEL1_ICACHE_SIZE 32768
328
+ LEVEL1_ICACHE_ASSOC 8
329
+ LEVEL1_ICACHE_LINESIZE 64
330
+ LEVEL1_DCACHE_SIZE 32768
331
+ LEVEL1_DCACHE_ASSOC 8
332
+ LEVEL1_DCACHE_LINESIZE 64
333
+ LEVEL2_CACHE_SIZE 262144
334
+ LEVEL2_CACHE_ASSOC 4
335
+ LEVEL2_CACHE_LINESIZE 64
336
+ LEVEL3_CACHE_SIZE 8388608
337
+ LEVEL3_CACHE_ASSOC 16
338
+ LEVEL3_CACHE_LINESIZE 64
339
+ LEVEL4_CACHE_SIZE 0
340
+ LEVEL4_CACHE_ASSOC 0
341
+ LEVEL4_CACHE_LINESIZE 0
342
+ IPV6 200809
343
+ RAW_SOCKETS 200809
344
+ _POSIX_IPV6 200809
345
+ _POSIX_RAW_SOCKETS 200809
346
+ GETCONF_OUT
347
+ allow(plugin).to receive(:which).with("getconf").and_return("/usr/bin/getconf")
348
+ allow(plugin).to receive(:shell_out).with("/usr/bin/getconf -a").and_return(mock_shell_out(0, getconf_out, ""))
349
+ plugin.run
350
+ expect(plugin[:sysconf].to_hash).to eq({
351
+ "LINK_MAX" => 65000,
352
+ "_POSIX_LINK_MAX" => 65000,
353
+ "MAX_CANON" => 255,
354
+ "_POSIX_MAX_CANON" => 255,
355
+ "MAX_INPUT" => 255,
356
+ "_POSIX_MAX_INPUT" => 255,
357
+ "NAME_MAX" => 255,
358
+ "_POSIX_NAME_MAX" => 255,
359
+ "PATH_MAX" => 4096,
360
+ "_POSIX_PATH_MAX" => 4096,
361
+ "PIPE_BUF" => 4096,
362
+ "_POSIX_PIPE_BUF" => 4096,
363
+ "SOCK_MAXBUF" => nil,
364
+ "_POSIX_ASYNC_IO" => nil,
365
+ "_POSIX_CHOWN_RESTRICTED" => 1,
366
+ "_POSIX_NO_TRUNC" => 1,
367
+ "_POSIX_PRIO_IO" => nil,
368
+ "_POSIX_SYNC_IO" => nil,
369
+ "_POSIX_VDISABLE" => 0,
370
+ "ARG_MAX" => 2097152,
371
+ "ATEXIT_MAX" => 2147483647,
372
+ "CHAR_BIT" => 8,
373
+ "CHAR_MAX" => 127,
374
+ "CHAR_MIN" => -128,
375
+ "CHILD_MAX" => 63672,
376
+ "CLK_TCK" => 100,
377
+ "INT_MAX" => 2147483647,
378
+ "INT_MIN" => -2147483648,
379
+ "IOV_MAX" => 1024,
380
+ "LOGNAME_MAX" => 256,
381
+ "LONG_BIT" => 64,
382
+ "MB_LEN_MAX" => 16,
383
+ "NGROUPS_MAX" => 65536,
384
+ "NL_ARGMAX" => 4096,
385
+ "NL_LANGMAX" => 2048,
386
+ "NL_MSGMAX" => 2147483647,
387
+ "NL_NMAX" => 2147483647,
388
+ "NL_SETMAX" => 2147483647,
389
+ "NL_TEXTMAX" => 2147483647,
390
+ "NSS_BUFLEN_GROUP" => 1024,
391
+ "NSS_BUFLEN_PASSWD" => 1024,
392
+ "NZERO" => 20,
393
+ "OPEN_MAX" => 1024,
394
+ "PAGESIZE" => 4096,
395
+ "PAGE_SIZE" => 4096,
396
+ "PASS_MAX" => 8192,
397
+ "PTHREAD_DESTRUCTOR_ITERATIONS" => 4,
398
+ "PTHREAD_KEYS_MAX" => 1024,
399
+ "PTHREAD_STACK_MIN" => 16384,
400
+ "PTHREAD_THREADS_MAX" => nil,
401
+ "SCHAR_MAX" => 127,
402
+ "SCHAR_MIN" => -128,
403
+ "SHRT_MAX" => 32767,
404
+ "SHRT_MIN" => -32768,
405
+ "SSIZE_MAX" => 32767,
406
+ "TTY_NAME_MAX" => 32,
407
+ "TZNAME_MAX" => 6,
408
+ "UCHAR_MAX" => 255,
409
+ "UINT_MAX" => 4294967295,
410
+ "UIO_MAXIOV" => 1024,
411
+ "ULONG_MAX" => 18446744073709551615,
412
+ "USHRT_MAX" => 65535,
413
+ "WORD_BIT" => 32,
414
+ "_AVPHYS_PAGES" => 2101393,
415
+ "_NPROCESSORS_CONF" => 8,
416
+ "_NPROCESSORS_ONLN" => 8,
417
+ "_PHYS_PAGES" => 4096040,
418
+ "_POSIX_ARG_MAX" => 2097152,
419
+ "_POSIX_ASYNCHRONOUS_IO" => 200809,
420
+ "_POSIX_CHILD_MAX" => 63672,
421
+ "_POSIX_FSYNC" => 200809,
422
+ "_POSIX_JOB_CONTROL" => 1,
423
+ "_POSIX_MAPPED_FILES" => 200809,
424
+ "_POSIX_MEMLOCK" => 200809,
425
+ "_POSIX_MEMLOCK_RANGE" => 200809,
426
+ "_POSIX_MEMORY_PROTECTION" => 200809,
427
+ "_POSIX_MESSAGE_PASSING" => 200809,
428
+ "_POSIX_NGROUPS_MAX" => 65536,
429
+ "_POSIX_OPEN_MAX" => 1024,
430
+ "_POSIX_PII" => nil,
431
+ "_POSIX_PII_INTERNET" => nil,
432
+ "_POSIX_PII_INTERNET_DGRAM" => nil,
433
+ "_POSIX_PII_INTERNET_STREAM" => nil,
434
+ "_POSIX_PII_OSI" => nil,
435
+ "_POSIX_PII_OSI_CLTS" => nil,
436
+ "_POSIX_PII_OSI_COTS" => nil,
437
+ "_POSIX_PII_OSI_M" => nil,
438
+ "_POSIX_PII_SOCKET" => nil,
439
+ "_POSIX_PII_XTI" => nil,
440
+ "_POSIX_POLL" => nil,
441
+ "_POSIX_PRIORITIZED_IO" => 200809,
442
+ "_POSIX_PRIORITY_SCHEDULING" => 200809,
443
+ "_POSIX_REALTIME_SIGNALS" => 200809,
444
+ "_POSIX_SAVED_IDS" => 1,
445
+ "_POSIX_SELECT" => nil,
446
+ "_POSIX_SEMAPHORES" => 200809,
447
+ "_POSIX_SHARED_MEMORY_OBJECTS" => 200809,
448
+ "_POSIX_SSIZE_MAX" => 32767,
449
+ "_POSIX_STREAM_MAX" => 16,
450
+ "_POSIX_SYNCHRONIZED_IO" => 200809,
451
+ "_POSIX_THREADS" => 200809,
452
+ "_POSIX_THREAD_ATTR_STACKADDR" => 200809,
453
+ "_POSIX_THREAD_ATTR_STACKSIZE" => 200809,
454
+ "_POSIX_THREAD_PRIORITY_SCHEDULING" => 200809,
455
+ "_POSIX_THREAD_PRIO_INHERIT" => 200809,
456
+ "_POSIX_THREAD_PRIO_PROTECT" => 200809,
457
+ "_POSIX_THREAD_ROBUST_PRIO_INHERIT" => nil,
458
+ "_POSIX_THREAD_ROBUST_PRIO_PROTECT" => nil,
459
+ "_POSIX_THREAD_PROCESS_SHARED" => 200809,
460
+ "_POSIX_THREAD_SAFE_FUNCTIONS" => 200809,
461
+ "_POSIX_TIMERS" => 200809,
462
+ "TIMER_MAX" => nil,
463
+ "_POSIX_TZNAME_MAX" => 6,
464
+ "_POSIX_VERSION" => 200809,
465
+ "_T_IOV_MAX" => nil,
466
+ "_XOPEN_CRYPT" => 1,
467
+ "_XOPEN_ENH_I18N" => 1,
468
+ "_XOPEN_LEGACY" => 1,
469
+ "_XOPEN_REALTIME" => 1,
470
+ "_XOPEN_REALTIME_THREADS" => 1,
471
+ "_XOPEN_SHM" => 1,
472
+ "_XOPEN_UNIX" => 1,
473
+ "_XOPEN_VERSION" => 700,
474
+ "_XOPEN_XCU_VERSION" => 4,
475
+ "_XOPEN_XPG2" => 1,
476
+ "_XOPEN_XPG3" => 1,
477
+ "_XOPEN_XPG4" => 1,
478
+ "BC_BASE_MAX" => 99,
479
+ "BC_DIM_MAX" => 2048,
480
+ "BC_SCALE_MAX" => 99,
481
+ "BC_STRING_MAX" => 1000,
482
+ "CHARCLASS_NAME_MAX" => 2048,
483
+ "COLL_WEIGHTS_MAX" => 255,
484
+ "EQUIV_CLASS_MAX" => nil,
485
+ "EXPR_NEST_MAX" => 32,
486
+ "LINE_MAX" => 2048,
487
+ "POSIX2_BC_BASE_MAX" => 99,
488
+ "POSIX2_BC_DIM_MAX" => 2048,
489
+ "POSIX2_BC_SCALE_MAX" => 99,
490
+ "POSIX2_BC_STRING_MAX" => 1000,
491
+ "POSIX2_CHAR_TERM" => 200809,
492
+ "POSIX2_COLL_WEIGHTS_MAX" => 255,
493
+ "POSIX2_C_BIND" => 200809,
494
+ "POSIX2_C_DEV" => 200809,
495
+ "POSIX2_C_VERSION" => 200809,
496
+ "POSIX2_EXPR_NEST_MAX" => 32,
497
+ "POSIX2_FORT_DEV" => nil,
498
+ "POSIX2_FORT_RUN" => nil,
499
+ "_POSIX2_LINE_MAX" => 2048,
500
+ "POSIX2_LINE_MAX" => 2048,
501
+ "POSIX2_LOCALEDEF" => 200809,
502
+ "POSIX2_RE_DUP_MAX" => 32767,
503
+ "POSIX2_SW_DEV" => 200809,
504
+ "POSIX2_UPE" => nil,
505
+ "POSIX2_VERSION" => 200809,
506
+ "RE_DUP_MAX" => 32767,
507
+ "PATH" => "/bin:/usr/bin",
508
+ "CS_PATH" => "/bin:/usr/bin",
509
+ "LFS_CFLAGS" => nil,
510
+ "LFS_LDFLAGS" => nil,
511
+ "LFS_LIBS" => nil,
512
+ "LFS_LINTFLAGS" => nil,
513
+ "LFS64_CFLAGS" => "-D_LARGEFILE64_SOURCE",
514
+ "LFS64_LDFLAGS" => nil,
515
+ "LFS64_LIBS" => nil,
516
+ "LFS64_LINTFLAGS" => "-D_LARGEFILE64_SOURCE",
517
+ "_XBS5_WIDTH_RESTRICTED_ENVS" => "XBS5_LP64_OFF64",
518
+ "XBS5_WIDTH_RESTRICTED_ENVS" => "XBS5_LP64_OFF64",
519
+ "_XBS5_ILP32_OFF32" => nil,
520
+ "XBS5_ILP32_OFF32_CFLAGS" => nil,
521
+ "XBS5_ILP32_OFF32_LDFLAGS" => nil,
522
+ "XBS5_ILP32_OFF32_LIBS" => nil,
523
+ "XBS5_ILP32_OFF32_LINTFLAGS" => nil,
524
+ "_XBS5_ILP32_OFFBIG" => nil,
525
+ "XBS5_ILP32_OFFBIG_CFLAGS" => nil,
526
+ "XBS5_ILP32_OFFBIG_LDFLAGS" => nil,
527
+ "XBS5_ILP32_OFFBIG_LIBS" => nil,
528
+ "XBS5_ILP32_OFFBIG_LINTFLAGS" => nil,
529
+ "_XBS5_LP64_OFF64" => 1,
530
+ "XBS5_LP64_OFF64_CFLAGS" => "-m64",
531
+ "XBS5_LP64_OFF64_LDFLAGS" => "-m64",
532
+ "XBS5_LP64_OFF64_LIBS" => nil,
533
+ "XBS5_LP64_OFF64_LINTFLAGS" => nil,
534
+ "_XBS5_LPBIG_OFFBIG" => nil,
535
+ "XBS5_LPBIG_OFFBIG_CFLAGS" => nil,
536
+ "XBS5_LPBIG_OFFBIG_LDFLAGS" => nil,
537
+ "XBS5_LPBIG_OFFBIG_LIBS" => nil,
538
+ "XBS5_LPBIG_OFFBIG_LINTFLAGS" => nil,
539
+ "_POSIX_V6_ILP32_OFF32" => nil,
540
+ "POSIX_V6_ILP32_OFF32_CFLAGS" => nil,
541
+ "POSIX_V6_ILP32_OFF32_LDFLAGS" => nil,
542
+ "POSIX_V6_ILP32_OFF32_LIBS" => nil,
543
+ "POSIX_V6_ILP32_OFF32_LINTFLAGS" => nil,
544
+ "_POSIX_V6_WIDTH_RESTRICTED_ENVS" => "POSIX_V6_LP64_OFF64",
545
+ "POSIX_V6_WIDTH_RESTRICTED_ENVS" => "POSIX_V6_LP64_OFF64",
546
+ "_POSIX_V6_ILP32_OFFBIG" => nil,
547
+ "POSIX_V6_ILP32_OFFBIG_CFLAGS" => nil,
548
+ "POSIX_V6_ILP32_OFFBIG_LDFLAGS" => nil,
549
+ "POSIX_V6_ILP32_OFFBIG_LIBS" => nil,
550
+ "POSIX_V6_ILP32_OFFBIG_LINTFLAGS" => nil,
551
+ "_POSIX_V6_LP64_OFF64" => 1,
552
+ "POSIX_V6_LP64_OFF64_CFLAGS" => "-m64",
553
+ "POSIX_V6_LP64_OFF64_LDFLAGS" => "-m64",
554
+ "POSIX_V6_LP64_OFF64_LIBS" => nil,
555
+ "POSIX_V6_LP64_OFF64_LINTFLAGS" => nil,
556
+ "_POSIX_V6_LPBIG_OFFBIG" => nil,
557
+ "POSIX_V6_LPBIG_OFFBIG_CFLAGS" => nil,
558
+ "POSIX_V6_LPBIG_OFFBIG_LDFLAGS" => nil,
559
+ "POSIX_V6_LPBIG_OFFBIG_LIBS" => nil,
560
+ "POSIX_V6_LPBIG_OFFBIG_LINTFLAGS" => nil,
561
+ "_POSIX_V7_ILP32_OFF32" => nil,
562
+ "POSIX_V7_ILP32_OFF32_CFLAGS" => nil,
563
+ "POSIX_V7_ILP32_OFF32_LDFLAGS" => nil,
564
+ "POSIX_V7_ILP32_OFF32_LIBS" => nil,
565
+ "POSIX_V7_ILP32_OFF32_LINTFLAGS" => nil,
566
+ "_POSIX_V7_WIDTH_RESTRICTED_ENVS" => "POSIX_V7_LP64_OFF64",
567
+ "POSIX_V7_WIDTH_RESTRICTED_ENVS" => "POSIX_V7_LP64_OFF64",
568
+ "_POSIX_V7_ILP32_OFFBIG" => nil,
569
+ "POSIX_V7_ILP32_OFFBIG_CFLAGS" => nil,
570
+ "POSIX_V7_ILP32_OFFBIG_LDFLAGS" => nil,
571
+ "POSIX_V7_ILP32_OFFBIG_LIBS" => nil,
572
+ "POSIX_V7_ILP32_OFFBIG_LINTFLAGS" => nil,
573
+ "_POSIX_V7_LP64_OFF64" => 1,
574
+ "POSIX_V7_LP64_OFF64_CFLAGS" => "-m64",
575
+ "POSIX_V7_LP64_OFF64_LDFLAGS" => "-m64",
576
+ "POSIX_V7_LP64_OFF64_LIBS" => nil,
577
+ "POSIX_V7_LP64_OFF64_LINTFLAGS" => nil,
578
+ "_POSIX_V7_LPBIG_OFFBIG" => nil,
579
+ "POSIX_V7_LPBIG_OFFBIG_CFLAGS" => nil,
580
+ "POSIX_V7_LPBIG_OFFBIG_LDFLAGS" => nil,
581
+ "POSIX_V7_LPBIG_OFFBIG_LIBS" => nil,
582
+ "POSIX_V7_LPBIG_OFFBIG_LINTFLAGS" => nil,
583
+ "_POSIX_ADVISORY_INFO" => 200809,
584
+ "_POSIX_BARRIERS" => 200809,
585
+ "_POSIX_BASE" => nil,
586
+ "_POSIX_C_LANG_SUPPORT" => nil,
587
+ "_POSIX_C_LANG_SUPPORT_R" => nil,
588
+ "_POSIX_CLOCK_SELECTION" => 200809,
589
+ "_POSIX_CPUTIME" => 200809,
590
+ "_POSIX_THREAD_CPUTIME" => 200809,
591
+ "_POSIX_DEVICE_SPECIFIC" => nil,
592
+ "_POSIX_DEVICE_SPECIFIC_R" => nil,
593
+ "_POSIX_FD_MGMT" => nil,
594
+ "_POSIX_FIFO" => nil,
595
+ "_POSIX_PIPE" => nil,
596
+ "_POSIX_FILE_ATTRIBUTES" => nil,
597
+ "_POSIX_FILE_LOCKING" => nil,
598
+ "_POSIX_FILE_SYSTEM" => nil,
599
+ "_POSIX_MONOTONIC_CLOCK" => 200809,
600
+ "_POSIX_MULTI_PROCESS" => nil,
601
+ "_POSIX_SINGLE_PROCESS" => nil,
602
+ "_POSIX_NETWORKING" => nil,
603
+ "_POSIX_READER_WRITER_LOCKS" => 200809,
604
+ "_POSIX_SPIN_LOCKS" => 200809,
605
+ "_POSIX_REGEXP" => 1,
606
+ "_REGEX_VERSION" => nil,
607
+ "_POSIX_SHELL" => 1,
608
+ "_POSIX_SIGNALS" => nil,
609
+ "_POSIX_SPAWN" => 200809,
610
+ "_POSIX_SPORADIC_SERVER" => nil,
611
+ "_POSIX_THREAD_SPORADIC_SERVER" => nil,
612
+ "_POSIX_SYSTEM_DATABASE" => nil,
613
+ "_POSIX_SYSTEM_DATABASE_R" => nil,
614
+ "_POSIX_TIMEOUTS" => 200809,
615
+ "_POSIX_TYPED_MEMORY_OBJECTS" => nil,
616
+ "_POSIX_USER_GROUPS" => nil,
617
+ "_POSIX_USER_GROUPS_R" => nil,
618
+ "POSIX2_PBS" => nil,
619
+ "POSIX2_PBS_ACCOUNTING" => nil,
620
+ "POSIX2_PBS_LOCATE" => nil,
621
+ "POSIX2_PBS_TRACK" => nil,
622
+ "POSIX2_PBS_MESSAGE" => nil,
623
+ "SYMLOOP_MAX" => nil,
624
+ "STREAM_MAX" => 16,
625
+ "AIO_LISTIO_MAX" => nil,
626
+ "AIO_MAX" => nil,
627
+ "AIO_PRIO_DELTA_MAX" => 20,
628
+ "DELAYTIMER_MAX" => 2147483647,
629
+ "HOST_NAME_MAX" => 64,
630
+ "LOGIN_NAME_MAX" => 256,
631
+ "MQ_OPEN_MAX" => nil,
632
+ "MQ_PRIO_MAX" => 32768,
633
+ "_POSIX_DEVICE_IO" => nil,
634
+ "_POSIX_TRACE" => nil,
635
+ "_POSIX_TRACE_EVENT_FILTER" => nil,
636
+ "_POSIX_TRACE_INHERIT" => nil,
637
+ "_POSIX_TRACE_LOG" => nil,
638
+ "RTSIG_MAX" => 32,
639
+ "SEM_NSEMS_MAX" => nil,
640
+ "SEM_VALUE_MAX" => 2147483647,
641
+ "SIGQUEUE_MAX" => 63672,
642
+ "FILESIZEBITS" => 64,
643
+ "POSIX_ALLOC_SIZE_MIN" => 4096,
644
+ "POSIX_REC_INCR_XFER_SIZE" => nil,
645
+ "POSIX_REC_MAX_XFER_SIZE" => nil,
646
+ "POSIX_REC_MIN_XFER_SIZE" => 4096,
647
+ "POSIX_REC_XFER_ALIGN" => 4096,
648
+ "SYMLINK_MAX" => nil,
649
+ "GNU_LIBC_VERSION" => "glibc 2.24",
650
+ "GNU_LIBPTHREAD_VERSION" => "NPTL 2.24",
651
+ "POSIX2_SYMLINKS" => 1,
652
+ "LEVEL1_ICACHE_SIZE" => 32768,
653
+ "LEVEL1_ICACHE_ASSOC" => 8,
654
+ "LEVEL1_ICACHE_LINESIZE" => 64,
655
+ "LEVEL1_DCACHE_SIZE" => 32768,
656
+ "LEVEL1_DCACHE_ASSOC" => 8,
657
+ "LEVEL1_DCACHE_LINESIZE" => 64,
658
+ "LEVEL2_CACHE_SIZE" => 262144,
659
+ "LEVEL2_CACHE_ASSOC" => 4,
660
+ "LEVEL2_CACHE_LINESIZE" => 64,
661
+ "LEVEL3_CACHE_SIZE" => 8388608,
662
+ "LEVEL3_CACHE_ASSOC" => 16,
663
+ "LEVEL3_CACHE_LINESIZE" => 64,
664
+ "LEVEL4_CACHE_SIZE" => 0,
665
+ "LEVEL4_CACHE_ASSOC" => 0,
666
+ "LEVEL4_CACHE_LINESIZE" => 0,
667
+ "IPV6" => 200809,
668
+ "RAW_SOCKETS" => 200809,
669
+ "_POSIX_IPV6" => 200809,
670
+ "_POSIX_RAW_SOCKETS" => 200809,
671
+ })
672
+ end
673
+
674
+ it "should not populate sysconf if getconf is not found" do
675
+ allow(plugin).to receive(:which).with("getconf").and_return(false)
676
+ plugin.run
677
+ expect(plugin[:sysconf]).to be(nil)
678
+ end
679
+ end