ohai 14.2.0 → 14.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Rakefile +1 -1
  4. data/lib/ohai/application.rb +29 -29
  5. data/lib/ohai/common/dmi.rb +5 -5
  6. data/lib/ohai/dsl/plugin.rb +3 -3
  7. data/lib/ohai/dsl/plugin/versionvii.rb +3 -3
  8. data/lib/ohai/mixin/azure_metadata.rb +2 -2
  9. data/lib/ohai/mixin/do_metadata.rb +3 -3
  10. data/lib/ohai/mixin/ec2_metadata.rb +8 -8
  11. data/lib/ohai/mixin/gce_metadata.rb +2 -2
  12. data/lib/ohai/mixin/network_constants.rb +1 -1
  13. data/lib/ohai/mixin/scaleway_metadata.rb +3 -3
  14. data/lib/ohai/mixin/softlayer_metadata.rb +1 -1
  15. data/lib/ohai/mixin/string.rb +2 -2
  16. data/lib/ohai/plugins/aix/cpu.rb +3 -3
  17. data/lib/ohai/plugins/aix/filesystem.rb +1 -1
  18. data/lib/ohai/plugins/aix/kernel.rb +1 -1
  19. data/lib/ohai/plugins/aix/memory.rb +1 -1
  20. data/lib/ohai/plugins/aix/network.rb +3 -3
  21. data/lib/ohai/plugins/bsd/virtualization.rb +1 -1
  22. data/lib/ohai/plugins/cloud.rb +1 -1
  23. data/lib/ohai/plugins/darwin/hardware.rb +1 -1
  24. data/lib/ohai/plugins/darwin/network.rb +5 -5
  25. data/lib/ohai/plugins/darwin/platform.rb +1 -1
  26. data/lib/ohai/plugins/dmi.rb +6 -6
  27. data/lib/ohai/plugins/filesystem.rb +5 -5
  28. data/lib/ohai/plugins/hostname.rb +5 -5
  29. data/lib/ohai/plugins/kernel.rb +8 -8
  30. data/lib/ohai/plugins/linux/lspci.rb +4 -4
  31. data/lib/ohai/plugins/linux/memory.rb +4 -4
  32. data/lib/ohai/plugins/linux/network.rb +16 -16
  33. data/lib/ohai/plugins/linux/platform.rb +7 -1
  34. data/lib/ohai/plugins/netbsd/network.rb +1 -1
  35. data/lib/ohai/plugins/network.rb +5 -5
  36. data/lib/ohai/plugins/openbsd/network.rb +1 -1
  37. data/lib/ohai/plugins/packages.rb +1 -1
  38. data/lib/ohai/plugins/passwd.rb +4 -4
  39. data/lib/ohai/plugins/ruby.rb +13 -13
  40. data/lib/ohai/plugins/solaris2/dmi.rb +3 -3
  41. data/lib/ohai/plugins/solaris2/filesystem.rb +6 -6
  42. data/lib/ohai/plugins/solaris2/memory.rb +2 -2
  43. data/lib/ohai/plugins/solaris2/network.rb +36 -36
  44. data/lib/ohai/plugins/windows/network.rb +2 -2
  45. data/lib/ohai/util/win32/group_helper.rb +1 -1
  46. data/lib/ohai/version.rb +1 -1
  47. data/spec/functional/application_spec.rb +6 -6
  48. data/spec/functional/loader_spec.rb +4 -4
  49. data/spec/functional/plugins/windows/uptime_spec.rb +1 -2
  50. data/spec/spec_helper.rb +5 -5
  51. data/spec/unit/application_spec.rb +11 -11
  52. data/spec/unit/config_spec.rb +5 -5
  53. data/spec/unit/dsl/plugin_spec.rb +5 -5
  54. data/spec/unit/hints_spec.rb +2 -2
  55. data/spec/unit/loader_spec.rb +41 -41
  56. data/spec/unit/mixin/azure_metadata_spec.rb +3 -3
  57. data/spec/unit/mixin/command_spec.rb +64 -64
  58. data/spec/unit/mixin/ec2_metadata_spec.rb +6 -6
  59. data/spec/unit/mixin/softlayer_metadata_spec.rb +1 -1
  60. data/spec/unit/plugin_config_spec.rb +9 -9
  61. data/spec/unit/plugins/abort_spec.rb +6 -6
  62. data/spec/unit/plugins/aix/cpu_spec.rb +16 -16
  63. data/spec/unit/plugins/aix/filesystem_spec.rb +57 -57
  64. data/spec/unit/plugins/aix/network_spec.rb +35 -35
  65. data/spec/unit/plugins/aix/virtualization_spec.rb +210 -210
  66. data/spec/unit/plugins/azure_spec.rb +49 -49
  67. data/spec/unit/plugins/bsd/filesystem_spec.rb +13 -13
  68. data/spec/unit/plugins/bsd/virtualization_spec.rb +10 -10
  69. data/spec/unit/plugins/c_spec.rb +54 -54
  70. data/spec/unit/plugins/chef_spec.rb +3 -3
  71. data/spec/unit/plugins/darwin/cpu_spec.rb +54 -54
  72. data/spec/unit/plugins/darwin/filesystem_spec.rb +34 -34
  73. data/spec/unit/plugins/darwin/hardware_system_profiler_output.rb +1070 -1070
  74. data/spec/unit/plugins/darwin/memory_spec.rb +16 -16
  75. data/spec/unit/plugins/darwin/network_spec.rb +382 -382
  76. data/spec/unit/plugins/digital_ocean_spec.rb +7 -7
  77. data/spec/unit/plugins/dmi_spec.rb +83 -83
  78. data/spec/unit/plugins/docker_spec.rb +2 -2
  79. data/spec/unit/plugins/ec2_spec.rb +156 -156
  80. data/spec/unit/plugins/eucalyptus_spec.rb +19 -19
  81. data/spec/unit/plugins/fail_spec.rb +14 -14
  82. data/spec/unit/plugins/freebsd/cpu_spec.rb +18 -18
  83. data/spec/unit/plugins/freebsd/kernel_spec.rb +1 -1
  84. data/spec/unit/plugins/gce_spec.rb +1 -1
  85. data/spec/unit/plugins/init_package_spec.rb +1 -1
  86. data/spec/unit/plugins/java_spec.rb +4 -4
  87. data/spec/unit/plugins/joyent_spec.rb +9 -9
  88. data/spec/unit/plugins/linux/block_device_spec.rb +1 -1
  89. data/spec/unit/plugins/linux/cpu_spec.rb +155 -155
  90. data/spec/unit/plugins/linux/filesystem_spec.rb +229 -229
  91. data/spec/unit/plugins/linux/kernel_spec.rb +9 -9
  92. data/spec/unit/plugins/linux/lsb_spec.rb +18 -18
  93. data/spec/unit/plugins/linux/lspci_spec.rb +58 -58
  94. data/spec/unit/plugins/linux/mdadm_spec.rb +54 -54
  95. data/spec/unit/plugins/linux/memory_spec.rb +35 -35
  96. data/spec/unit/plugins/linux/network_spec.rb +464 -464
  97. data/spec/unit/plugins/linux/platform_spec.rb +84 -68
  98. data/spec/unit/plugins/linux/systemd_paths_spec.rb +40 -40
  99. data/spec/unit/plugins/linux/uptime_spec.rb +1 -1
  100. data/spec/unit/plugins/linux/virtualization_spec.rb +197 -197
  101. data/spec/unit/plugins/mono_spec.rb +11 -11
  102. data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -1
  103. data/spec/unit/plugins/network_spec.rb +2 -2
  104. data/spec/unit/plugins/openstack_spec.rb +43 -43
  105. data/spec/unit/plugins/os_spec.rb +1 -1
  106. data/spec/unit/plugins/passwd_spec.rb +9 -9
  107. data/spec/unit/plugins/php_spec.rb +22 -22
  108. data/spec/unit/plugins/powershell_spec.rb +13 -13
  109. data/spec/unit/plugins/rackspace_spec.rb +38 -38
  110. data/spec/unit/plugins/ruby_spec.rb +14 -14
  111. data/spec/unit/plugins/scaleway_spec.rb +6 -6
  112. data/spec/unit/plugins/scsi_spec.rb +7 -7
  113. data/spec/unit/plugins/solaris2/cpu_spec.rb +2594 -2594
  114. data/spec/unit/plugins/solaris2/dmi_spec.rb +91 -91
  115. data/spec/unit/plugins/solaris2/filesystem.rb +8 -8
  116. data/spec/unit/plugins/solaris2/kernel_spec.rb +1 -1
  117. data/spec/unit/plugins/solaris2/network_spec.rb +92 -93
  118. data/spec/unit/plugins/solaris2/platform_spec.rb +24 -24
  119. data/spec/unit/plugins/solaris2/virtualization_spec.rb +22 -22
  120. data/spec/unit/plugins/ssh_host_keys_spec.rb +12 -12
  121. data/spec/unit/plugins/sysconf_spec.rb +321 -321
  122. data/spec/unit/plugins/virtualbox_spec.rb +27 -27
  123. data/spec/unit/plugins/windows/cpu_spec.rb +9 -9
  124. data/spec/unit/plugins/windows/kernel_spec.rb +12 -12
  125. data/spec/unit/plugins/windows/uptime_spec.rb +1 -1
  126. data/spec/unit/plugins/zpools_spec.rb +41 -41
  127. data/spec/unit/runner_spec.rb +2 -2
  128. data/spec/unit/system_spec.rb +55 -55
  129. metadata +3 -4
  130. data/docs/man/man1/ohai.1 +0 -97
@@ -23,17 +23,17 @@ describe Ohai::System, "plugin mono" do
23
23
 
24
24
  before(:each) do
25
25
  plugin[:languages] = Mash.new
26
- @stdout = <<-OUT
27
- Mono JIT compiler version 4.2.3 (Stable 4.2.3.4/832de4b Wed Mar 30 13:57:48 PDT 2016)
28
- Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
29
- TLS: normal
30
- SIGSEGV: altstack
31
- Notification: kqueue
32
- Architecture: amd64
33
- Disabled: none
34
- Misc: softdebug
35
- LLVM: supported, not enabled.
36
- GC: sgen
26
+ @stdout = <<~OUT
27
+ Mono JIT compiler version 4.2.3 (Stable 4.2.3.4/832de4b Wed Mar 30 13:57:48 PDT 2016)
28
+ Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
29
+ TLS: normal
30
+ SIGSEGV: altstack
31
+ Notification: kqueue
32
+ Architecture: amd64
33
+ Disabled: none
34
+ Misc: softdebug
35
+ LLVM: supported, not enabled.
36
+ GC: sgen
37
37
  OUT
38
38
  allow(plugin).to receive(:shell_out).with("mono -V").and_return(mock_shell_out(0, @stdout, ""))
39
39
  end
@@ -25,7 +25,7 @@ describe Ohai::System, "NetBSD kernel plugin" do
25
25
  allow(@plugin).to receive(:init_kernel).and_return({})
26
26
  allow(@plugin).to receive(:shell_out).with("uname -i").and_return(mock_shell_out(0, "foo", ""))
27
27
  allow(@plugin).to receive(:shell_out).with("sysctl kern.securelevel").and_return(mock_shell_out(0, "kern.securelevel: 1\n", ""))
28
- allow(@plugin).to receive(:shell_out).with("#{Ohai.abs_path( "/usr/bin/modstat" )}").and_return(mock_shell_out(0, " 1 7 0xc0400000 97f830 kernel", ""))
28
+ allow(@plugin).to receive(:shell_out).with((Ohai.abs_path( "/usr/bin/modstat" )).to_s).and_return(mock_shell_out(0, " 1 7 0xc0400000 97f830 kernel", ""))
29
29
  end
30
30
 
31
31
  it "should set the kernel_os to the kernel_name value" do
@@ -929,7 +929,7 @@ describe Ohai::System, "Network Plugin" do
929
929
  @plugin["network"]["default_gateway"] = nil
930
930
  @plugin["network"]["default_interface"] = nil
931
931
  @plugin["network"]["interfaces"].each_value do |val|
932
- if val.has_key? "addresses"
932
+ if val.key? "addresses"
933
933
  val["addresses"].delete_if { |k, kv| kv["family"] == "inet" }
934
934
  end
935
935
  end
@@ -1014,7 +1014,7 @@ describe Ohai::System, "Network Plugin" do
1014
1014
  @plugin["network"]["default_gateway"] = nil
1015
1015
  @plugin["network"]["default_interface"] = nil
1016
1016
  @plugin["network"]["interfaces"].each_value do |val|
1017
- if val.has_key? "addresses"
1017
+ if val.key? "addresses"
1018
1018
  val["addresses"].delete_if { |k, kv| kv["family"] == "inet" }
1019
1019
  end
1020
1020
  end
@@ -37,16 +37,16 @@ describe Ohai::System, "plugin openstack" do
37
37
  context "when DMI data is Openstack" do
38
38
  context "and the metadata service is not available" do
39
39
  before do
40
- allow(plugin).to receive(:can_socket_connect?).
41
- with(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, 80).
42
- and_return(false)
40
+ allow(plugin).to receive(:can_socket_connect?)
41
+ .with(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, 80)
42
+ .and_return(false)
43
43
  plugin[:dmi] = dmi_data
44
44
  plugin.run
45
45
  end
46
46
 
47
47
  context "with normal openstack metadata" do
48
48
  let(:dmi_data) do
49
- { :system => { :all_records => [ { :Manufacturer => "OpenStack Foundation" } ] } }
49
+ { system: { all_records: [ { Manufacturer: "OpenStack Foundation" } ] } }
50
50
  end
51
51
 
52
52
  it "sets openstack attribute" do
@@ -59,7 +59,7 @@ describe Ohai::System, "plugin openstack" do
59
59
  end
60
60
  context "with Red Hat openstack metadata" do
61
61
  let(:dmi_data) do
62
- { :system => { :manufacturer => "Red Hat", :product_name => "OpenStack Compute" } }
62
+ { system: { manufacturer: "Red Hat", product_name: "OpenStack Compute" } }
63
63
  end
64
64
 
65
65
  it "sets openstack attribute" do
@@ -76,10 +76,10 @@ describe Ohai::System, "plugin openstack" do
76
76
  context "when running on dreamhost" do
77
77
  it "sets openstack provider attribute to dreamhost" do
78
78
  plugin["etc"] = { "passwd" => { "dhc-user" => {} } }
79
- allow(plugin).to receive(:can_socket_connect?).
80
- with(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, 80).
81
- and_return(false)
82
- plugin[:dmi] = { :system => { :all_records => [ { :Manufacturer => "OpenStack Foundation" } ] } }
79
+ allow(plugin).to receive(:can_socket_connect?)
80
+ .with(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, 80)
81
+ .and_return(false)
82
+ plugin[:dmi] = { system: { all_records: [ { Manufacturer: "OpenStack Foundation" } ] } }
83
83
  plugin.run
84
84
  expect(plugin[:openstack][:provider]).to eq("dreamhost")
85
85
  end
@@ -88,9 +88,9 @@ describe Ohai::System, "plugin openstack" do
88
88
  context "when the hint is present" do
89
89
  context "and the metadata service is not available" do
90
90
  before do
91
- allow(plugin).to receive(:can_socket_connect?).
92
- with(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, 80).
93
- and_return(false)
91
+ allow(plugin).to receive(:can_socket_connect?)
92
+ .with(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, 80)
93
+ .and_return(false)
94
94
  allow(plugin).to receive(:hint?).with("openstack").and_return(true)
95
95
  plugin.run
96
96
  end
@@ -109,25 +109,25 @@ describe Ohai::System, "plugin openstack" do
109
109
  let(:metadata_version) { "2009-04-04" }
110
110
 
111
111
  let(:metadata_root) do
112
- <<EOM
113
- reservation-id
114
- public-keys/
115
- security-groups
116
- public-ipv4
117
- ami-manifest-path
118
- instance-type
119
- instance-id
120
- local-ipv4
121
- ari-id
122
- local-hostname
123
- placement/
124
- ami-launch-index
125
- public-hostname
126
- hostname
127
- ami-id
128
- instance-action
129
- aki-id
130
- block-device-mapping/
112
+ <<~EOM
113
+ reservation-id
114
+ public-keys/
115
+ security-groups
116
+ public-ipv4
117
+ ami-manifest-path
118
+ instance-type
119
+ instance-id
120
+ local-ipv4
121
+ ari-id
122
+ local-hostname
123
+ placement/
124
+ ami-launch-index
125
+ public-hostname
126
+ hostname
127
+ ami-id
128
+ instance-action
129
+ aki-id
130
+ block-device-mapping/
131
131
  EOM
132
132
  end
133
133
 
@@ -182,26 +182,26 @@ EOM
182
182
  let(:http_client) { double("Net::HTTP", { :read_timeout= => nil, :keep_alive_timeout= => nil } ) }
183
183
 
184
184
  def allow_get(url, response_body)
185
- allow(http_client).to receive(:get).
186
- with(url).
187
- and_return(double("HTTP Response", :code => "200", :body => response_body))
185
+ allow(http_client).to receive(:get)
186
+ .with(url)
187
+ .and_return(double("HTTP Response", code: "200", body: response_body))
188
188
  end
189
189
 
190
190
  def allow_get_response(url, response_body)
191
- allow(http_client).to receive(:get_response).
192
- with(url, nil, nil).
193
- and_return(double("HTTP Response", :code => "200", :body => response_body))
191
+ allow(http_client).to receive(:get_response)
192
+ .with(url, nil, nil)
193
+ .and_return(double("HTTP Response", code: "200", body: response_body))
194
194
  end
195
195
 
196
196
  before do
197
197
  allow(plugin).to receive(:hint?).with("openstack").and_return(true)
198
- allow(plugin).to receive(:can_socket_connect?).
199
- with(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, 80).
200
- and_return(true)
198
+ allow(plugin).to receive(:can_socket_connect?)
199
+ .with(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, 80)
200
+ .and_return(true)
201
201
 
202
- allow(Net::HTTP).to receive(:start).
203
- with(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR).
204
- and_return(http_client)
202
+ allow(Net::HTTP).to receive(:start)
203
+ .with(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR)
204
+ .and_return(http_client)
205
205
 
206
206
  allow(plugin).to receive(:best_api_version).and_return(metadata_version)
207
207
 
@@ -60,7 +60,7 @@ describe Ohai::System, "plugin os" do
60
60
 
61
61
  describe "on solaris" do
62
62
  before do
63
- ::RbConfig::CONFIG["host_os"] = "solaris2.42" #heh
63
+ ::RbConfig::CONFIG["host_os"] = "solaris2.42" # heh
64
64
  end
65
65
 
66
66
  it "sets the os to solaris2" do
@@ -25,18 +25,18 @@ describe Ohai::System, "plugin etc", :unix_only do
25
25
  GroupEntry = Struct.new(:name, :gid, :mem)
26
26
 
27
27
  it "should include a list of all users" do
28
- expect(Etc).to receive(:passwd).and_yield(PasswdEntry.new("root", 1, 1, "/root", "/bin/zsh", "BOFH")).
29
- and_yield(PasswdEntry.new("www", 800, 800, "/var/www", "/bin/false", "Serving the web since 1970"))
28
+ expect(Etc).to receive(:passwd).and_yield(PasswdEntry.new("root", 1, 1, "/root", "/bin/zsh", "BOFH"))
29
+ .and_yield(PasswdEntry.new("www", 800, 800, "/var/www", "/bin/false", "Serving the web since 1970"))
30
30
  @plugin.run
31
- expect(@plugin[:etc][:passwd]["root"]).to eq(Mash.new(:shell => "/bin/zsh", :gecos => "BOFH", :gid => 1, :uid => 1, :dir => "/root"))
32
- expect(@plugin[:etc][:passwd]["www"]).to eq(Mash.new(:shell => "/bin/false", :gecos => "Serving the web since 1970", :gid => 800, :uid => 800, :dir => "/var/www"))
31
+ expect(@plugin[:etc][:passwd]["root"]).to eq(Mash.new(shell: "/bin/zsh", gecos: "BOFH", gid: 1, uid: 1, dir: "/root"))
32
+ expect(@plugin[:etc][:passwd]["www"]).to eq(Mash.new(shell: "/bin/false", gecos: "Serving the web since 1970", gid: 800, uid: 800, dir: "/var/www"))
33
33
  end
34
34
 
35
35
  it "should ignore duplicate users" do
36
- expect(Etc).to receive(:passwd).and_yield(PasswdEntry.new("root", 1, 1, "/root", "/bin/zsh", "BOFH")).
37
- and_yield(PasswdEntry.new("root", 1, 1, "/", "/bin/false", "I do not belong"))
36
+ expect(Etc).to receive(:passwd).and_yield(PasswdEntry.new("root", 1, 1, "/root", "/bin/zsh", "BOFH"))
37
+ .and_yield(PasswdEntry.new("root", 1, 1, "/", "/bin/false", "I do not belong"))
38
38
  @plugin.run
39
- expect(@plugin[:etc][:passwd]["root"]).to eq(Mash.new(:shell => "/bin/zsh", :gecos => "BOFH", :gid => 1, :uid => 1, :dir => "/root"))
39
+ expect(@plugin[:etc][:passwd]["root"]).to eq(Mash.new(shell: "/bin/zsh", gecos: "BOFH", gid: 1, uid: 1, dir: "/root"))
40
40
  end
41
41
 
42
42
  it "should set the current user" do
@@ -49,8 +49,8 @@ describe Ohai::System, "plugin etc", :unix_only do
49
49
  it "should set the available groups" do
50
50
  expect(Etc).to receive(:group).and_yield(GroupEntry.new("admin", 100, %w{root chef})).and_yield(GroupEntry.new("www", 800, %w{www deploy}))
51
51
  @plugin.run
52
- expect(@plugin[:etc][:group]["admin"]).to eq(Mash.new(:gid => 100, :members => %w{root chef}))
53
- expect(@plugin[:etc][:group]["www"]).to eq(Mash.new(:gid => 800, :members => %w{www deploy}))
52
+ expect(@plugin[:etc][:group]["admin"]).to eq(Mash.new(gid: 100, members: %w{root chef}))
53
+ expect(@plugin[:etc][:group]["www"]).to eq(Mash.new(gid: 800, members: %w{www deploy}))
54
54
  end
55
55
 
56
56
  if "".respond_to?(:force_encoding)
@@ -25,10 +25,10 @@ describe Ohai::System, "plugin php" do
25
25
 
26
26
  before(:each) do
27
27
  plugin[:languages] = Mash.new
28
- @stdout = <<-OUT
29
- PHP 5.1.6 (cli) (built: Jul 16 2008 19:52:52)
30
- Copyright (c) 1997-2006 The PHP Group
31
- Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
28
+ @stdout = <<~OUT
29
+ PHP 5.1.6 (cli) (built: Jul 16 2008 19:52:52)
30
+ Copyright (c) 1997-2006 The PHP Group
31
+ Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
32
32
  OUT
33
33
  allow(plugin).to receive(:shell_out).with("php -v").and_return(mock_shell_out(0, @stdout, ""))
34
34
  end
@@ -44,11 +44,11 @@ OUT
44
44
  end
45
45
 
46
46
  it "sets languages[:php][:version] on PHP 7.0" do
47
- stdout = <<-OUT
48
- PHP 7.0.4-7ubuntu2.1 (cli) ( NTS )
49
- Copyright (c) 1997-2016 The PHP Group
50
- Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
51
- with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
47
+ stdout = <<~OUT
48
+ PHP 7.0.4-7ubuntu2.1 (cli) ( NTS )
49
+ Copyright (c) 1997-2016 The PHP Group
50
+ Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
51
+ with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
52
52
  OUT
53
53
  allow(plugin).to receive(:shell_out).with("php -v").and_return(mock_shell_out(0, stdout, ""))
54
54
  plugin.run
@@ -62,10 +62,10 @@ OUT
62
62
  end
63
63
 
64
64
  it "parses builddate even if PHP is Suhosin patched" do
65
- stdout = <<-OUT
66
- PHP 5.3.27 with Suhosin-Patch (cli) (built: Aug 30 2013 04:30:30)
67
- Copyright (c) 1997-2013 The PHP Group
68
- Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
65
+ stdout = <<~OUT
66
+ PHP 5.3.27 with Suhosin-Patch (cli) (built: Aug 30 2013 04:30:30)
67
+ Copyright (c) 1997-2013 The PHP Group
68
+ Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
69
69
  OUT
70
70
  allow(plugin).to receive(:shell_out).with("php -v").and_return(mock_shell_out(0, stdout, ""))
71
71
  plugin.run
@@ -73,10 +73,10 @@ OUT
73
73
  end
74
74
 
75
75
  it "does not set zend_optcache_version if not compiled with opcache" do
76
- stdout = <<-OUT
77
- PHP 5.1.6 (cli) (built: Jul 16 2008 19:52:52)
78
- Copyright (c) 1997-2006 The PHP Group
79
- Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
76
+ stdout = <<~OUT
77
+ PHP 5.1.6 (cli) (built: Jul 16 2008 19:52:52)
78
+ Copyright (c) 1997-2006 The PHP Group
79
+ Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
80
80
  OUT
81
81
  allow(plugin).to receive(:shell_out).with("php -v").and_return(mock_shell_out(0, stdout, ""))
82
82
  plugin.run
@@ -84,11 +84,11 @@ OUT
84
84
  end
85
85
 
86
86
  it "sets zend_optcache_version if compiled with opcache" do
87
- stdout = <<-OUT
88
- PHP 5.5.9-1ubuntu4.5 (cli) (built: Oct 29 2014 11:59:10)
89
- Copyright (c) 1997-2014 The PHP Group
90
- Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
91
- with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
87
+ stdout = <<~OUT
88
+ PHP 5.5.9-1ubuntu4.5 (cli) (built: Oct 29 2014 11:59:10)
89
+ Copyright (c) 1997-2014 The PHP Group
90
+ Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
91
+ with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
92
92
  OUT
93
93
  allow(plugin).to receive(:shell_out).with("php -v").and_return(mock_shell_out(0, stdout, ""))
94
94
  plugin.run
@@ -30,17 +30,17 @@ describe Ohai::System, "plugin powershell" do
30
30
 
31
31
  it "sets languages[:powershell][:version] for v4" do
32
32
 
33
- v4_output = <<END
33
+ v4_output = <<~END
34
34
 
35
- Name Value
36
- ---- -----
37
- PSVersion 4.0
38
- WSManStackVersion 3.0
39
- SerializationVersion 1.1.0.1
40
- CLRVersion 4.0.30319.34014
41
- BuildVersion 6.3.9600.16394
42
- PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
43
- PSRemotingProtocolVersion 2.2
35
+ Name Value
36
+ ---- -----
37
+ PSVersion 4.0
38
+ WSManStackVersion 3.0
39
+ SerializationVersion 1.1.0.1
40
+ CLRVersion 4.0.30319.34014
41
+ BuildVersion 6.3.9600.16394
42
+ PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
43
+ PSRemotingProtocolVersion 2.2
44
44
 
45
45
  END
46
46
  compat_version_array = ["1.0", "2.0", "3.0", "4.0"]
@@ -58,9 +58,9 @@ END
58
58
  end
59
59
 
60
60
  it "does not set the languages[:powershell] tree up if powershell command fails" do
61
- error_output = <<END
62
- 'powershell.exe' is not recognized as an internal or external command,
63
- operable program or batch file.
61
+ error_output = <<~END
62
+ 'powershell.exe' is not recognized as an internal or external command,
63
+ operable program or batch file.
64
64
  END
65
65
 
66
66
  allow(plugin).to receive(:shell_out).with(anything).and_return(mock_shell_out(1, error_output, ""))
@@ -27,8 +27,8 @@ describe Ohai::System, "plugin rackspace" do
27
27
  plugin[:hostname] = "katie"
28
28
 
29
29
  plugin[:network] = {
30
- :interfaces => {
31
- :eth0 => {
30
+ interfaces: {
31
+ eth0: {
32
32
  "addresses" => {
33
33
  "1.2.3.4" => {
34
34
  "broadcast" => "67.23.20.255",
@@ -54,7 +54,7 @@ describe Ohai::System, "plugin rackspace" do
54
54
  }
55
55
 
56
56
  plugin[:network][:interfaces][:eth1] = {
57
- :addresses => {
57
+ addresses: {
58
58
  "fe80::4240:f5ff:feab:2836" => {
59
59
  "scope" => "Link",
60
60
  "prefixlen" => "64",
@@ -73,7 +73,7 @@ describe Ohai::System, "plugin rackspace" do
73
73
 
74
74
  # In olden days we could detect rackspace by a -rscloud suffix on the kernel
75
75
  # This is here to make #has_rackspace_kernel? fail until we remove that check
76
- plugin[:kernel] = { :release => "1.2.13-not-rackspace" }
76
+ plugin[:kernel] = { release: "1.2.13-not-rackspace" }
77
77
 
78
78
  # We need a generic stub here for the later stubs with arguments to work
79
79
  # Because, magic.
@@ -131,12 +131,12 @@ describe Ohai::System, "plugin rackspace" do
131
131
  end
132
132
 
133
133
  it "captures region information" do
134
- provider_data = <<-OUT
135
- provider = "Rackspace"
136
- service_type = "cloudServers"
137
- server_id = "21301000"
138
- created_at = "2012-12-06T22:08:16Z"
139
- region = "dfw"
134
+ provider_data = <<~OUT
135
+ provider = "Rackspace"
136
+ service_type = "cloudServers"
137
+ server_id = "21301000"
138
+ created_at = "2012-12-06T22:08:16Z"
139
+ region = "dfw"
140
140
  OUT
141
141
  allow(plugin).to receive(:shell_out).with("xenstore-ls vm-data/provider_data").and_return(mock_shell_out(0, provider_data, ""))
142
142
  plugin.run
@@ -144,14 +144,14 @@ OUT
144
144
  end
145
145
 
146
146
  it "logs a debug message when region info cannot be collected" do
147
- expect(plugin).
148
- to receive(:shell_out).
149
- with("xenstore-ls vm-data/provider_data").
150
- and_raise(Ohai::Exceptions::Exec)
151
-
152
- expect(plugin.logger).
153
- to receive(:trace).
154
- with("Plugin Rackspace: Unable to find xenstore-ls, cannot capture " \
147
+ expect(plugin)
148
+ .to receive(:shell_out)
149
+ .with("xenstore-ls vm-data/provider_data")
150
+ .and_raise(Ohai::Exceptions::Exec)
151
+
152
+ expect(plugin.logger)
153
+ .to receive(:trace)
154
+ .with("Plugin Rackspace: Unable to find xenstore-ls, cannot capture " \
155
155
  "region information for Rackspace cloud")
156
156
 
157
157
  plugin.run
@@ -167,14 +167,14 @@ OUT
167
167
  end
168
168
 
169
169
  it "logs error if instance id cannot be found" do
170
- expect(plugin).
171
- to receive(:shell_out).
172
- with("xenstore-read name").
173
- and_raise(Ohai::Exceptions::Exec)
174
-
175
- expect(plugin.logger).
176
- to receive(:trace).
177
- with("Plugin Rackspace: Unable to find xenstore-read, cannot capture " \
170
+ expect(plugin)
171
+ .to receive(:shell_out)
172
+ .with("xenstore-read name")
173
+ .and_raise(Ohai::Exceptions::Exec)
174
+
175
+ expect(plugin.logger)
176
+ .to receive(:trace)
177
+ .with("Plugin Rackspace: Unable to find xenstore-read, cannot capture " \
178
178
  "instance ID information for Rackspace cloud")
179
179
 
180
180
  plugin.run
@@ -260,10 +260,10 @@ OUT
260
260
 
261
261
  before(:each) do
262
262
  allow(plugin).to receive(:hint?).with("rackspace").and_return(false)
263
- allow(plugin).
264
- to receive(:shell_out).
265
- with("xenstore-read vm-data/provider_data/provider").
266
- and_raise(Ohai::Exceptions::Exec)
263
+ allow(plugin)
264
+ .to receive(:shell_out)
265
+ .with("xenstore-read vm-data/provider_data/provider")
266
+ .and_raise(Ohai::Exceptions::Exec)
267
267
  end
268
268
  end
269
269
 
@@ -271,14 +271,14 @@ OUT
271
271
  it "logs an error and does not collect private_networks" do
272
272
  allow(plugin).to receive(:hint?).with("rackspace").and_return(true)
273
273
 
274
- expect(plugin).
275
- to receive(:shell_out).
276
- with("xenstore-ls vm-data/networking").
277
- and_raise(Ohai::Exceptions::Exec)
274
+ expect(plugin)
275
+ .to receive(:shell_out)
276
+ .with("xenstore-ls vm-data/networking")
277
+ .and_raise(Ohai::Exceptions::Exec)
278
278
 
279
- expect(plugin.logger).
280
- to receive(:trace).
281
- with("Plugin Rackspace: Unable to capture custom private networking " \
279
+ expect(plugin.logger)
280
+ .to receive(:trace)
281
+ .with("Plugin Rackspace: Unable to capture custom private networking " \
282
282
  "information for Rackspace cloud")
283
283
 
284
284
  plugin.run
@@ -305,7 +305,7 @@ OUT
305
305
  describe "has private networks" do
306
306
  before do
307
307
  plugin[:network][:interfaces][:eth2] = {
308
- :addresses => {
308
+ addresses: {
309
309
  "fe80::be76:4eff:fe20:422b" => {
310
310
  "scope" => "Link",
311
311
  "prefixlen" => "64",