ohai 8.8.1 → 8.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/Rakefile +6 -0
- data/bin/ohai +2 -2
- data/lib/ohai.rb +4 -4
- data/lib/ohai/config.rb +2 -2
- data/lib/ohai/dsl.rb +2 -2
- data/lib/ohai/dsl/plugin.rb +3 -3
- data/lib/ohai/dsl/plugin/versionvi.rb +3 -3
- data/lib/ohai/dsl/plugin/versionvii.rb +2 -2
- data/lib/ohai/exception.rb +2 -2
- data/lib/ohai/hints.rb +2 -2
- data/lib/ohai/loader.rb +1 -1
- data/lib/ohai/log.rb +2 -2
- data/lib/ohai/mixin/command.rb +2 -2
- data/lib/ohai/mixin/constant_helper.rb +2 -2
- data/lib/ohai/mixin/dmi_decode.rb +1 -1
- data/lib/ohai/mixin/ec2_metadata.rb +3 -3
- data/lib/ohai/mixin/network_constants.rb +4 -4
- data/lib/ohai/mixin/os.rb +2 -2
- data/lib/ohai/mixin/seconds_to_human.rb +4 -4
- data/lib/ohai/mixin/string.rb +4 -4
- data/lib/ohai/plugin_config.rb +1 -1
- data/lib/ohai/plugins/aix/cpu.rb +35 -29
- data/lib/ohai/plugins/aix/filesystem.rb +58 -40
- data/lib/ohai/plugins/aix/kernel.rb +3 -2
- data/lib/ohai/plugins/aix/memory.rb +4 -3
- data/lib/ohai/plugins/aix/network.rb +6 -4
- data/lib/ohai/plugins/aix/os.rb +30 -0
- data/lib/ohai/plugins/aix/platform.rb +3 -2
- data/lib/ohai/plugins/aix/uptime.rb +3 -2
- data/lib/ohai/plugins/aix/virtualization.rb +115 -5
- data/lib/ohai/plugins/azure.rb +1 -1
- data/lib/ohai/plugins/bsd/filesystem.rb +1 -1
- data/lib/ohai/plugins/command.rb +4 -4
- data/lib/ohai/plugins/darwin/cpu.rb +5 -3
- data/lib/ohai/plugins/darwin/filesystem.rb +4 -4
- data/lib/ohai/plugins/darwin/filesystem2.rb +4 -4
- data/lib/ohai/plugins/darwin/memory.rb +6 -5
- data/lib/ohai/plugins/darwin/network.rb +2 -2
- data/lib/ohai/plugins/darwin/platform.rb +2 -2
- data/lib/ohai/plugins/darwin/system_profiler.rb +2 -2
- data/lib/ohai/plugins/dragonflybsd/os.rb +2 -2
- data/lib/ohai/plugins/ec2.rb +3 -3
- data/lib/ohai/plugins/erlang.rb +3 -3
- data/lib/ohai/plugins/eucalyptus.rb +3 -3
- data/lib/ohai/plugins/freebsd/cpu.rb +8 -4
- data/lib/ohai/plugins/freebsd/os.rb +2 -2
- data/lib/ohai/plugins/hostname.rb +12 -4
- data/lib/ohai/plugins/init_package.rb +2 -8
- data/lib/ohai/plugins/java.rb +2 -2
- data/lib/ohai/plugins/kernel.rb +5 -4
- data/lib/ohai/plugins/keys.rb +3 -3
- data/lib/ohai/plugins/languages.rb +4 -4
- data/lib/ohai/plugins/linux/block_device.rb +3 -3
- data/lib/ohai/plugins/linux/cpu.rb +2 -2
- data/lib/ohai/plugins/linux/filesystem.rb +2 -2
- data/lib/ohai/plugins/linux/filesystem2.rb +3 -3
- data/lib/ohai/plugins/linux/lsb.rb +2 -2
- data/lib/ohai/plugins/linux/memory.rb +2 -2
- data/lib/ohai/plugins/linux/network.rb +141 -59
- data/lib/ohai/plugins/linux/platform.rb +6 -1
- data/lib/ohai/plugins/linux/virtualization.rb +1 -1
- data/lib/ohai/plugins/network.rb +49 -42
- data/lib/ohai/plugins/ohai_time.rb +4 -4
- data/lib/ohai/plugins/openstack.rb +2 -2
- data/lib/ohai/plugins/os.rb +2 -2
- data/lib/ohai/plugins/packages.rb +122 -0
- data/lib/ohai/plugins/perl.rb +5 -5
- data/lib/ohai/plugins/platform.rb +2 -2
- data/lib/ohai/plugins/powershell.rb +2 -2
- data/lib/ohai/plugins/ps.rb +2 -2
- data/lib/ohai/plugins/python.rb +1 -1
- data/lib/ohai/plugins/rackspace.rb +13 -0
- data/lib/ohai/plugins/ruby.rb +6 -6
- data/lib/ohai/plugins/sigar/network_route.rb +1 -1
- data/lib/ohai/plugins/solaris2/filesystem.rb +1 -1
- data/lib/ohai/plugins/solaris2/network.rb +1 -1
- data/lib/ohai/plugins/solaris2/platform.rb +1 -1
- data/lib/ohai/plugins/solaris2/virtualization.rb +5 -5
- data/lib/ohai/plugins/solaris2/zpools.rb +2 -2
- data/lib/ohai/plugins/ssh_host_key.rb +2 -2
- data/lib/ohai/plugins/uptime.rb +4 -4
- data/lib/ohai/plugins/virtualbox.rb +1 -1
- data/lib/ohai/plugins/virtualization.rb +7 -7
- data/lib/ohai/plugins/vmware.rb +1 -1
- data/lib/ohai/plugins/windows/filesystem.rb +1 -1
- data/lib/ohai/plugins/windows/network.rb +1 -1
- data/lib/ohai/plugins/windows/platform.rb +1 -1
- data/lib/ohai/plugins/windows/virtualization.rb +1 -1
- data/lib/ohai/provides_map.rb +3 -3
- data/lib/ohai/runner.rb +2 -2
- data/lib/ohai/system.rb +2 -2
- data/lib/ohai/util/file_helper.rb +1 -1
- data/lib/ohai/util/win32.rb +1 -1
- data/lib/ohai/util/win32/group_helper.rb +1 -1
- data/lib/ohai/version.rb +3 -3
- data/spec/data/plugins/dpkg-query.output +1087 -0
- data/spec/data/plugins/lslpp.output +49 -0
- data/spec/data/plugins/pkginfo.output +50 -0
- data/spec/data/plugins/pkglist.output +24 -0
- data/spec/data/plugins/rpmquery.output +388 -0
- data/spec/functional/application_spec.rb +1 -1
- data/spec/functional/loader_spec.rb +1 -1
- data/spec/functional/plugins/powershell_spec.rb +1 -1
- data/spec/functional/plugins/root_group_spec.rb +2 -2
- data/spec/ohai_spec.rb +6 -6
- data/spec/unit/application_spec.rb +1 -1
- data/spec/unit/config_spec.rb +1 -1
- data/spec/unit/dsl/plugin_spec.rb +2 -2
- data/spec/unit/hints_spec.rb +2 -2
- data/spec/unit/loader_spec.rb +2 -2
- data/spec/unit/mixin/ec2_metadata_spec.rb +1 -1
- data/spec/unit/plugin_config_spec.rb +1 -1
- data/spec/unit/plugins/aix/cpu_spec.rb +68 -40
- data/spec/unit/plugins/aix/filesystem_spec.rb +152 -50
- data/spec/unit/plugins/aix/hostname_spec.rb +5 -3
- data/spec/unit/plugins/aix/kernel_spec.rb +2 -1
- data/spec/unit/plugins/aix/memory_spec.rb +7 -5
- data/spec/unit/plugins/aix/network_spec.rb +17 -1
- data/spec/unit/plugins/aix/os_spec.rb +35 -0
- data/spec/unit/plugins/aix/platform_spec.rb +5 -4
- data/spec/unit/plugins/aix/uptime_spec.rb +2 -1
- data/spec/unit/plugins/aix/virtualization_spec.rb +269 -3
- data/spec/unit/plugins/azure_spec.rb +1 -1
- data/spec/unit/plugins/bsd/filesystem_spec.rb +1 -1
- data/spec/unit/plugins/bsd/virtualization_spec.rb +2 -2
- data/spec/unit/plugins/chef_spec.rb +8 -8
- data/spec/unit/plugins/darwin/cpu_spec.rb +8 -3
- data/spec/unit/plugins/darwin/hostname_spec.rb +2 -2
- data/spec/unit/plugins/darwin/kernel_spec.rb +4 -4
- data/spec/unit/plugins/darwin/memory_spec.rb +1 -1
- data/spec/unit/plugins/darwin/network_spec.rb +1 -1
- data/spec/unit/plugins/darwin/platform_spec.rb +6 -6
- data/spec/unit/plugins/darwin/system_profiler_output.rb +0 -1
- data/spec/unit/plugins/darwin/system_profiler_spec.rb +4 -4
- data/spec/unit/plugins/ec2_spec.rb +3 -3
- data/spec/unit/plugins/erlang_spec.rb +3 -3
- data/spec/unit/plugins/eucalyptus_spec.rb +2 -2
- data/spec/unit/plugins/fail_spec.rb +6 -6
- data/spec/unit/plugins/freebsd/cpu_spec.rb +19 -4
- data/spec/unit/plugins/freebsd/hostname_spec.rb +2 -2
- data/spec/unit/plugins/freebsd/kernel_spec.rb +4 -4
- data/spec/unit/plugins/freebsd/platform_spec.rb +7 -7
- data/spec/unit/plugins/hostname_spec.rb +2 -2
- data/spec/unit/plugins/init_package_spec.rb +12 -2
- data/spec/unit/plugins/java_spec.rb +5 -5
- data/spec/unit/plugins/kernel_spec.rb +4 -2
- data/spec/unit/plugins/linux/block_device_spec.rb +75 -0
- data/spec/unit/plugins/linux/cpu_spec.rb +2 -2
- data/spec/unit/plugins/linux/filesystem2_spec.rb +14 -14
- data/spec/unit/plugins/linux/filesystem_spec.rb +1 -1
- data/spec/unit/plugins/linux/hostname_spec.rb +2 -2
- data/spec/unit/plugins/linux/kernel_spec.rb +5 -5
- data/spec/unit/plugins/linux/lsb_spec.rb +17 -17
- data/spec/unit/plugins/linux/network_spec.rb +80 -11
- data/spec/unit/plugins/linux/platform_spec.rb +20 -1
- data/spec/unit/plugins/linux/uptime_spec.rb +8 -8
- data/spec/unit/plugins/linux/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/lua_spec.rb +2 -2
- data/spec/unit/plugins/netbsd/hostname_spec.rb +2 -2
- data/spec/unit/plugins/netbsd/kernel_spec.rb +2 -2
- data/spec/unit/plugins/netbsd/platform_spec.rb +2 -2
- data/spec/unit/plugins/network_spec.rb +110 -37
- data/spec/unit/plugins/nodejs_spec.rb +2 -2
- data/spec/unit/plugins/ohai_spec.rb +5 -5
- data/spec/unit/plugins/ohai_time_spec.rb +8 -8
- data/spec/unit/plugins/openbsd/hostname_spec.rb +2 -2
- data/spec/unit/plugins/openbsd/kernel_spec.rb +4 -4
- data/spec/unit/plugins/openbsd/platform_spec.rb +6 -6
- data/spec/unit/plugins/openstack_spec.rb +2 -2
- data/spec/unit/plugins/os_spec.rb +11 -11
- data/spec/unit/plugins/packages_spec.rb +241 -0
- data/spec/unit/plugins/perl_spec.rb +3 -3
- data/spec/unit/plugins/php_spec.rb +2 -2
- data/spec/unit/plugins/platform_spec.rb +2 -2
- data/spec/unit/plugins/python_spec.rb +3 -3
- data/spec/unit/plugins/rackspace_spec.rb +7 -0
- data/spec/unit/plugins/ruby_spec.rb +3 -3
- data/spec/unit/plugins/sigar/network_route_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/cpu_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/filesystem.rb +1 -1
- data/spec/unit/plugins/solaris2/network_spec.rb +3 -3
- data/spec/unit/plugins/solaris2/platform_spec.rb +5 -5
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/ssh_host_keys_spec.rb +2 -2
- data/spec/unit/plugins/virtualbox_spec.rb +1 -1
- data/spec/unit/plugins/windows/virtualization_spec.rb +1 -1
- data/spec/unit/provides_map_spec.rb +2 -2
- data/spec/unit/runner_spec.rb +2 -2
- data/spec/unit/system_spec.rb +3 -3
- data/spec/unit/util/file_helper_spec.rb +1 -1
- metadata +13 -3
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
3
|
-
# Copyright:: Copyright (c) 2011-
|
3
|
+
# Copyright:: Copyright (c) 2011-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Matthew Kent (<mkent@magoazul.com>)
|
3
3
|
# Author:: Tim Smith (<tsmith@chef.io>)
|
4
|
-
# Copyright:: Copyright (c) 2011-
|
4
|
+
# Copyright:: Copyright (c) 2011-2016 Chef Software, Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Bryan McLellan <btm@
|
3
|
-
# Copyright:: Copyright (c) 2012
|
2
|
+
# Author:: Bryan McLellan <btm@chef.io>
|
3
|
+
# Copyright:: Copyright (c) 2012-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,16 +1,16 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Adam Jacob (<adam@
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
3
|
# Author:: Tollef Fog Heen <tfheen@err.no>
|
4
|
-
# Copyright:: Copyright (c) 2008
|
4
|
+
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
5
5
|
# Copyright:: Copyright (c) 2010 Tollef Fog Heen <tfheen@err.no>
|
6
6
|
# License:: Apache License, Version 2.0
|
7
7
|
#
|
8
8
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
9
|
# you may not use this file except in compliance with the License.
|
10
10
|
# You may obtain a copy of the License at
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# Unless required by applicable law or agreed to in writing, software
|
15
15
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
16
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -20,9 +20,9 @@
|
|
20
20
|
|
21
21
|
begin
|
22
22
|
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
|
23
|
-
|
23
|
+
|
24
24
|
require 'chef/version'
|
25
|
-
|
25
|
+
|
26
26
|
describe Ohai::System, "plugin chef" do
|
27
27
|
before(:each) do
|
28
28
|
@plugin = get_plugin("chef")
|
@@ -32,10 +32,10 @@ begin
|
|
32
32
|
@plugin.run
|
33
33
|
expect(@plugin[:chef_packages][:chef][:version]).to eq(Chef::VERSION)
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
pending "would set [:chef_packages][:chef][:version] if chef was available", :unless => defined?(Chef)
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
rescue LoadError
|
40
40
|
# the chef module is not available, ignoring.
|
41
41
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Nathan L Smith (<nlloyds@gmail.com>)
|
3
|
-
# Copyright:: Copyright (c) 2013
|
3
|
+
# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -23,6 +23,7 @@ describe Ohai::System, "Darwin cpu plugin" do
|
|
23
23
|
before(:each) do
|
24
24
|
@plugin = get_plugin("darwin/cpu")
|
25
25
|
allow(@plugin).to receive(:collect_os).and_return(:darwin)
|
26
|
+
allow(@plugin).to receive(:shell_out).with("sysctl -n hw.packages").and_return(mock_shell_out(0, "1", ""))
|
26
27
|
allow(@plugin).to receive(:shell_out).with("sysctl -n hw.physicalcpu").and_return(mock_shell_out(0, "4", ""))
|
27
28
|
allow(@plugin).to receive(:shell_out).with("sysctl -n hw.logicalcpu").and_return(mock_shell_out(0, "8", ""))
|
28
29
|
allow(@plugin).to receive(:shell_out).with("sysctl -n hw.cpufrequency").and_return(mock_shell_out(0, "2300000000", ""))
|
@@ -35,12 +36,16 @@ describe Ohai::System, "Darwin cpu plugin" do
|
|
35
36
|
@plugin.run
|
36
37
|
end
|
37
38
|
|
39
|
+
it "should set cpu[:cores] to 4" do
|
40
|
+
expect(@plugin[:cpu][:cores]).to eq(4)
|
41
|
+
end
|
42
|
+
|
38
43
|
it "should set cpu[:total] to 8" do
|
39
44
|
expect(@plugin[:cpu][:total]).to eq(8)
|
40
45
|
end
|
41
46
|
|
42
|
-
it "should set cpu[:real] to
|
43
|
-
expect(@plugin[:cpu][:real]).to eq(
|
47
|
+
it "should set cpu[:real] to 1" do
|
48
|
+
expect(@plugin[:cpu][:real]).to eq(1)
|
44
49
|
end
|
45
50
|
|
46
51
|
it "should set cpu[:mhz] to 2300" do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Copyright:: Copyright (c) 2008
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,14 +1,14 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Copyright:: Copyright (c) 2008
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
14
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Patrick Collins (<pat@burned.com>)
|
3
|
-
# Copyright:: Copyright (c) 2013
|
3
|
+
# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Alan Harper <alan@aussiegeek.net>
|
3
|
-
# Copyright:: Copyright (c) 2012
|
3
|
+
# Copyright:: Copyright (c) 2012-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,14 +1,14 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Copyright:: Copyright (c) 2008
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
14
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -36,12 +36,12 @@ describe Ohai::System, "Darwin plugin platform" do
|
|
36
36
|
@plugin.run
|
37
37
|
expect(@plugin[:platform]).to eq("mac_os_x")
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
it "should set platform_version to ProductVersion" do
|
41
41
|
@plugin.run
|
42
42
|
expect(@plugin[:platform_version]).to eq("10.5.5")
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
it "should set platform_build to BuildVersion" do
|
46
46
|
@plugin.run
|
47
47
|
expect(@plugin[:platform_build]).to eq("9F33")
|
@@ -1,14 +1,14 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Paul Mooring (<paul@
|
3
|
-
# Copyright:: Copyright (c) 2012
|
2
|
+
# Author:: Paul Mooring (<paul@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) 2012-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
14
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Tim Dysinger (<tim@dysinger.net>)
|
3
|
-
# Author:: Christopher Brown (cb@
|
4
|
-
# Copyright:: Copyright (c) 2008
|
3
|
+
# Author:: Christopher Brown (cb@chef.io)
|
4
|
+
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -51,7 +51,7 @@ describe Ohai::System, "plugin ec2" do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
context "with common metadata paths" do
|
54
|
-
let(:paths) do
|
54
|
+
let(:paths) do
|
55
55
|
{ "meta-data/" => "instance_type\nami_id\nsecurity-groups",
|
56
56
|
"meta-data/instance_type" => "c1.medium",
|
57
57
|
"meta-data/ami_id" => "ami-5d2dc934",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Author:: Theodore Nordsieck (<theo@
|
4
|
-
# Copyright:: Copyright (c) 2008-
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Author:: Theodore Nordsieck (<theo@chef.io>)
|
4
|
+
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Tim Dysinger (<tim@dysinger.net>)
|
3
|
-
# Author:: Christopher Brown (cb@
|
4
|
-
# Copyright:: Copyright (c) 2008
|
3
|
+
# Author:: Christopher Brown (cb@chef.io)
|
4
|
+
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,15 +1,15 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Toomas Pelberg (toomas.pelberg@playtech.com>)
|
3
|
-
# Author:: Claire McQuin (claire@
|
4
|
-
# Copyright:: Copyright (c) 2011, 2013
|
3
|
+
# Author:: Claire McQuin (claire@chef.io)
|
4
|
+
# Copyright:: Copyright (c) 2011, 2013-2016 Chef Software, Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
# you may not use this file except in compliance with the License.
|
9
9
|
# You may obtain a copy of the License at
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# Unless required by applicable law or agreed to in writing, software
|
14
14
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
15
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -241,7 +241,7 @@ end
|
|
241
241
|
|
242
242
|
describe "when using nonexistent DSL commands in Ohai.plugin block" do
|
243
243
|
failstr = "Ohai.plugin do\n\tcreates \"fail\"\nend\n"
|
244
|
-
|
244
|
+
|
245
245
|
it_behaves_like "a v7 loading failure" do
|
246
246
|
let(:failstr) { failstr }
|
247
247
|
end
|
@@ -266,7 +266,7 @@ Ohai.plugin do
|
|
266
266
|
end
|
267
267
|
end
|
268
268
|
EOF
|
269
|
-
|
269
|
+
|
270
270
|
it_behaves_like "a v7 loading success" do
|
271
271
|
let(:failstr) { failstr1 }
|
272
272
|
end
|
@@ -22,7 +22,6 @@ describe Ohai::System, "FreeBSD cpu plugin on FreeBSD >=10.2" do
|
|
22
22
|
before(:each) do
|
23
23
|
@plugin = get_plugin("freebsd/cpu")
|
24
24
|
allow(@plugin).to receive(:collect_os).and_return(:freebsd)
|
25
|
-
allow(@plugin).to receive(:shell_out).with("sysctl -n hw.ncpu").and_return(mock_shell_out(0, "2", ""))
|
26
25
|
@double_file = double("/var/run/dmesg.boot")
|
27
26
|
allow(@double_file).to receive(:each).
|
28
27
|
and_yield('CPU: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz (2793.59-MHz K8-class CPU)').
|
@@ -32,7 +31,13 @@ describe Ohai::System, "FreeBSD cpu plugin on FreeBSD >=10.2" do
|
|
32
31
|
and_yield(' AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>').
|
33
32
|
and_yield(' AMD Features2=0x21<LAHF,ABM>').
|
34
33
|
and_yield(' Structured Extended Features=0x2000<NFPUSG>').
|
35
|
-
and_yield(' TSC: P-state invariant')
|
34
|
+
and_yield(' TSC: P-state invariant').
|
35
|
+
and_yield('real memory = 1073676288 (1023 MB)').
|
36
|
+
and_yield('avail memory = 1010253824 (963 MB)').
|
37
|
+
and_yield('Event timer "LAPIC" quality 400').
|
38
|
+
and_yield('ACPI APIC Table: <VBOX VBOXAPIC>').
|
39
|
+
and_yield('FreeBSD/SMP: Multiprocessor System Detected: 16 CPUs').
|
40
|
+
and_yield('FreeBSD/SMP: 2 package(s) x 4 core(s) x 2 SMT threads')
|
36
41
|
allow(File).to receive(:open).with("/var/run/dmesg.boot").and_return(@double_file)
|
37
42
|
end
|
38
43
|
|
@@ -71,9 +76,19 @@ describe Ohai::System, "FreeBSD cpu plugin on FreeBSD >=10.2" do
|
|
71
76
|
expect(@plugin[:cpu][:stepping]).to eq("1")
|
72
77
|
end
|
73
78
|
|
74
|
-
it "detects
|
79
|
+
it "detects real CPUs" do
|
80
|
+
@plugin.run
|
81
|
+
expect(@plugin[:cpu][:real]).to eq(2)
|
82
|
+
end
|
83
|
+
|
84
|
+
it "detects total real CPU cores" do
|
85
|
+
@plugin.run
|
86
|
+
expect(@plugin[:cpu][:cores]).to eq(8)
|
87
|
+
end
|
88
|
+
|
89
|
+
it "detects total HT CPU cores" do
|
75
90
|
@plugin.run
|
76
|
-
expect(@plugin[:cpu][:total]).to eq(
|
91
|
+
expect(@plugin[:cpu][:total]).to eq(16)
|
77
92
|
end
|
78
93
|
|
79
94
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Copyright:: Copyright (c) 2008
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,14 +1,14 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Copyright:: Copyright (c) 2008
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
14
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -1,14 +1,14 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Copyright:: Copyright (c) 2008
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
14
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -28,12 +28,12 @@ describe Ohai::System, "FreeBSD plugin platform" do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should set platform to lowercased lsb[:id]" do
|
31
|
-
@plugin.run
|
31
|
+
@plugin.run
|
32
32
|
expect(@plugin[:platform]).to eq("freebsd")
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
it "should set platform_version to lsb[:release]" do
|
36
36
|
@plugin.run
|
37
37
|
expect(@plugin[:platform_version]).to eq("7.1")
|
38
38
|
end
|
39
|
-
end
|
39
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Copyright:: Copyright (c) 2008
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Caleb Tennis (<caleb.tennis@gmail.com>)
|
3
|
-
# Copyright:: Copyright (c) 2012
|
3
|
+
# Copyright:: Copyright (c) 2012-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -26,11 +26,12 @@ describe Ohai::System, "Init package" do
|
|
26
26
|
}
|
27
27
|
|
28
28
|
let(:proc1_content) { "init\n" }
|
29
|
+
let(:proc1_exists) { true }
|
29
30
|
let(:proc_1_file_path) { "/proc/1/comm" }
|
30
31
|
let(:proc_1_file) { double(proc_1_file_path, :gets => proc1_content) }
|
31
32
|
|
32
33
|
before(:each) do
|
33
|
-
allow(File).to receive(:exists?).with(proc_1_file_path).and_return(
|
34
|
+
allow(File).to receive(:exists?).with(proc_1_file_path).and_return(proc1_exists)
|
34
35
|
allow(File).to receive(:open).with(proc_1_file_path).and_return(proc_1_file)
|
35
36
|
end
|
36
37
|
|
@@ -47,4 +48,13 @@ describe Ohai::System, "Init package" do
|
|
47
48
|
expect(plugin[:init_package]).to eq("systemd")
|
48
49
|
end
|
49
50
|
end
|
51
|
+
|
52
|
+
describe "when /proc/1/comm doesn't exist" do
|
53
|
+
let(:proc1_exists) { false }
|
54
|
+
|
55
|
+
it "should set init_package to init" do
|
56
|
+
plugin.run
|
57
|
+
expect(plugin[:init_package]).to eq("init")
|
58
|
+
end
|
59
|
+
end
|
50
60
|
end
|