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,8 +1,8 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Jacques Marneweck (<jacques@powertrip.co.za>)
|
3
|
-
# Author:: Theodore Nordsieck (<theo@
|
3
|
+
# Author:: Theodore Nordsieck (<theo@chef.io>)
|
4
4
|
# Copyright:: Copyright (c) Jacques Marneweck
|
5
|
-
# Copyright:: Copyright (c) 2013
|
5
|
+
# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
|
6
6
|
# License:: Apache License, Version 2.0
|
7
7
|
#
|
8
8
|
# 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.
|
@@ -24,7 +24,7 @@ describe Ohai::System, "plugin ohai" do
|
|
24
24
|
before(:each) do
|
25
25
|
@plugin = get_plugin("ohai")
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
it "should set [:chef_packages][:ohai][:version] to the current version" do
|
29
29
|
@plugin.run
|
30
30
|
expect(@plugin[:chef_packages][:ohai][:version]).to eq(Ohai::VERSION)
|
@@ -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.
|
@@ -23,23 +23,23 @@ describe Ohai::System, "plugin ohai_time" do
|
|
23
23
|
before(:each) do
|
24
24
|
@plugin = get_plugin("ohai_time")
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
it "should get the current time" do
|
28
28
|
expect(Time).to receive(:now)
|
29
29
|
@plugin.run
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
it "should turn the time into a floating point number" do
|
33
33
|
time = Time.now
|
34
34
|
expect(time).to receive(:to_f)
|
35
35
|
allow(Time).to receive(:now).and_return(time)
|
36
36
|
@plugin.run
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
it "should set ohai_time to the current time" do
|
40
40
|
time = Time.now
|
41
41
|
allow(Time).to receive(:now).and_return(time)
|
42
42
|
@plugin.run
|
43
|
-
expect(@plugin[:ohai_time]).to eq(time.to_f)
|
43
|
+
expect(@plugin[:ohai_time]).to eq(time.to_f)
|
44
44
|
end
|
45
45
|
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.
|
@@ -26,9 +26,9 @@ describe Ohai::System, "OpenBSD plugin platform" do
|
|
26
26
|
allow(@plugin).to receive(:shell_out).with("uname -r").and_return(mock_shell_out(0, "4.5\n", ""))
|
27
27
|
allow(@plugin).to receive(:collect_os).and_return(:openbsd)
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
it "should set platform_version to lsb[:release]" do
|
31
31
|
@plugin.run
|
32
32
|
expect(@plugin[:platform_version]).to eq("4.5")
|
33
33
|
end
|
34
|
-
end
|
34
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Daniel DeLeo (dan@
|
3
|
-
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
2
|
+
# Author:: Daniel DeLeo (dan@chef.io)
|
3
|
+
# Copyright:: Copyright (c) 2014-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.
|
@@ -27,7 +27,7 @@ describe Ohai::System, "plugin os" do
|
|
27
27
|
@plugin[:kernel] = Mash.new
|
28
28
|
@plugin[:kernel][:release] = "kings of leon"
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
after do
|
32
32
|
::RbConfig::CONFIG['host_os'] = ORIGINAL_CONFIG_HOST_OS
|
33
33
|
end
|
@@ -36,34 +36,34 @@ describe Ohai::System, "plugin os" do
|
|
36
36
|
@plugin.run
|
37
37
|
expect(@plugin[:os_version]).to eq(@plugin[:kernel][:release])
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
describe "on linux" do
|
41
41
|
before(:each) do
|
42
42
|
::RbConfig::CONFIG['host_os'] = "linux"
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
it "should set the os to linux" do
|
46
46
|
@plugin.run
|
47
47
|
expect(@plugin[:os]).to eq("linux")
|
48
48
|
end
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
describe "on darwin" do
|
52
52
|
before(:each) do
|
53
53
|
::RbConfig::CONFIG['host_os'] = "darwin10.0"
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
it "should set the os to darwin" do
|
57
57
|
@plugin.run
|
58
58
|
expect(@plugin[:os]).to eq("darwin")
|
59
59
|
end
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
describe "on solaris" do
|
63
63
|
before do
|
64
64
|
::RbConfig::CONFIG['host_os'] = "solaris2.42" #heh
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
it "sets the os to solaris2" do
|
68
68
|
@plugin.run
|
69
69
|
expect(@plugin[:os]).to eq("solaris2")
|
@@ -0,0 +1,241 @@
|
|
1
|
+
# Author:: Christopher M. Luciano (<cmlucian@us.ibm.com>)
|
2
|
+
# Author:: Shahul Khajamohideen (<skhajamohid1@bloomberg.net>)
|
3
|
+
# Copyright (C) 2015 IBM Corp.
|
4
|
+
# Copyright (C) 2015 Bloomberg Finance L.P.
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
|
21
|
+
|
22
|
+
describe Ohai::System, 'plugin packages' do
|
23
|
+
context 'on debian' do
|
24
|
+
let(:plugin) do
|
25
|
+
get_plugin('packages').tap do |plugin|
|
26
|
+
plugin[:platform_family] = 'debian'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
let(:stdout) do
|
31
|
+
File.read(File.join(SPEC_PLUGIN_PATH, 'dpkg-query.output'))
|
32
|
+
end
|
33
|
+
|
34
|
+
before(:each) do
|
35
|
+
allow(plugin).to receive(:collect_os).and_return(:linux)
|
36
|
+
allow(plugin).to receive(:shell_out)
|
37
|
+
.with('dpkg-query -W')
|
38
|
+
.and_return(mock_shell_out(0, stdout, ''))
|
39
|
+
plugin.run
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'calls dpkg query' do
|
43
|
+
expect(plugin).to receive(:shell_out)
|
44
|
+
.with('dpkg-query -W')
|
45
|
+
.and_return(mock_shell_out(0, stdout, ''))
|
46
|
+
plugin.run
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'gets packages and versions' do
|
50
|
+
expect(plugin[:packages]['vim-common'][:version]).to eq('2:7.4.052-1ubuntu3')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'on fedora' do
|
55
|
+
let(:plugin) do
|
56
|
+
get_plugin('packages').tap do |plugin|
|
57
|
+
plugin[:platform_family] = 'fedora'
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
let(:format) { Shellwords.escape '%{NAME}\t%{VERSION}\t%{RELEASE}\n' }
|
62
|
+
|
63
|
+
let(:stdout) do
|
64
|
+
File.read(File.join(SPEC_PLUGIN_PATH, 'rpmquery.output'))
|
65
|
+
end
|
66
|
+
|
67
|
+
before(:each) do
|
68
|
+
allow(plugin).to receive(:collect_os).and_return(:linux)
|
69
|
+
allow(plugin).to receive(:shell_out).with("rpm -qa --queryformat #{format}").and_return(mock_shell_out(0, stdout, ''))
|
70
|
+
plugin.run
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'calls rpm -qa' do
|
74
|
+
expect(plugin).to receive(:shell_out)
|
75
|
+
.with("rpm -qa --queryformat #{format}")
|
76
|
+
.and_return(mock_shell_out(0, stdout, ''))
|
77
|
+
plugin.run
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'gets packages and versions/release' do
|
81
|
+
expect(plugin[:packages]['vim-common'][:version]).to eq('7.2.411')
|
82
|
+
expect(plugin[:packages]['vim-common'][:release]).to eq('1.8.el6')
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context 'on windows', :windows_only do
|
87
|
+
require 'wmi-lite'
|
88
|
+
|
89
|
+
let(:plugin) do
|
90
|
+
get_plugin('packages').tap do |plugin|
|
91
|
+
plugin[:platform_family] = 'windows'
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
let(:win32_product_output) do
|
96
|
+
[{ 'assignmenttype' => 0,
|
97
|
+
'caption' => 'NXLOG-CE',
|
98
|
+
'description' => 'NXLOG-CE',
|
99
|
+
'helplink' => nil,
|
100
|
+
'helptelephone' => nil,
|
101
|
+
'identifyingnumber' => '{22FA28AB-3C1B-438B-A8B5-E23892C8B567}',
|
102
|
+
'installdate' => '20150511',
|
103
|
+
'installdate2' => nil,
|
104
|
+
'installlocation' => nil,
|
105
|
+
'installsource' => 'C:\\chef\\cache\\',
|
106
|
+
'installstate' => 5,
|
107
|
+
'language' => '1033',
|
108
|
+
'localpackage' => 'C:\\Windows\\Installer\\30884.msi',
|
109
|
+
'name' => 'NXLOG-CE',
|
110
|
+
'packagecache' => 'C:\\Windows\\Installer\\30884.msi',
|
111
|
+
'packagecode' => '{EC3A13C4-4634-47FC-9662-DC293CB96F9F}',
|
112
|
+
'packagename' => 'nexlog-ce-2.8.1248.msi',
|
113
|
+
'productid' => nil,
|
114
|
+
'regcompany' => nil,
|
115
|
+
'regowner' => nil,
|
116
|
+
'skunumber' => nil,
|
117
|
+
'transforms' => nil,
|
118
|
+
'urlinfoabout' => nil,
|
119
|
+
'urlupdateinfo' => nil,
|
120
|
+
'vendor' => 'nxsec.com',
|
121
|
+
'version' => '2.8.1248',
|
122
|
+
'wordcount' => 2 },
|
123
|
+
{ 'assignmenttype' => 1,
|
124
|
+
'caption' => 'Chef Development Kit v0.7.0',
|
125
|
+
'description' => 'Chef Development Kit v0.7.0',
|
126
|
+
'helplink' => 'http://www.getchef.com/support/',
|
127
|
+
'helptelephone' => nil,
|
128
|
+
'identifyingnumber' => '{90754A33-404C-4172-8F3B-7F04CE98011C}',
|
129
|
+
'installdate' => '20150925', 'installdate2' => nil,
|
130
|
+
'installlocation' => nil,
|
131
|
+
'installsource' => 'C:\\Users\\skhajamohid1\\Downloads\\',
|
132
|
+
'installstate' => 5, 'language' => '1033',
|
133
|
+
'localpackage' => 'C:\\WINDOWS\\Installer\\d9e1ca7.msi',
|
134
|
+
'name' => 'Chef Development Kit v0.7.0',
|
135
|
+
'packagecache' => 'C:\\WINDOWS\\Installer\\d9e1ca7.msi',
|
136
|
+
'packagecode' => '{9B82FB86-40AE-4CDF-9DE8-97574F9395B9}',
|
137
|
+
'packagename' => 'chefdk-0.7.0-1 (2).msi',
|
138
|
+
'productid' => nil,
|
139
|
+
'regcompany' => nil,
|
140
|
+
'regowner' => nil,
|
141
|
+
'skunumber' => nil,
|
142
|
+
'transforms' => nil,
|
143
|
+
'urlinfoabout' => nil,
|
144
|
+
'urlupdateinfo' => nil,
|
145
|
+
'vendor' => "\"Chef Software, Inc. <maintainers@chef.io>\"",
|
146
|
+
'version' => '0.7.0.1',
|
147
|
+
'wordcount' => 2 }]
|
148
|
+
end
|
149
|
+
|
150
|
+
before(:each) do
|
151
|
+
allow(plugin).to receive(:collect_os).and_return(:windows)
|
152
|
+
expect_any_instance_of(WmiLite::Wmi).to receive(:instances_of).with('Win32_Product').and_return(win32_product_output)
|
153
|
+
plugin.run
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'gets package info' do
|
157
|
+
expect(plugin[:packages]['Chef Development Kit v0.7.0'][:version]).to eq('0.7.0.1')
|
158
|
+
expect(plugin[:packages]['Chef Development Kit v0.7.0'][:vendor]).to eq("\"Chef Software, Inc. <maintainers@chef.io>\"")
|
159
|
+
expect(plugin[:packages]['Chef Development Kit v0.7.0'][:installdate]).to eq('20150925')
|
160
|
+
|
161
|
+
expect(plugin[:packages]['NXLOG-CE'][:version]).to eq('2.8.1248')
|
162
|
+
expect(plugin[:packages]['NXLOG-CE'][:vendor]).to eq('nxsec.com')
|
163
|
+
expect(plugin[:packages]['NXLOG-CE'][:installdate]).to eq('20150511')
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
context 'on aix' do
|
168
|
+
let(:plugin) { get_plugin('packages') }
|
169
|
+
|
170
|
+
let(:stdout) do
|
171
|
+
File.read(File.join(SPEC_PLUGIN_PATH, 'lslpp.output'))
|
172
|
+
end
|
173
|
+
|
174
|
+
before(:each) do
|
175
|
+
allow(plugin).to receive(:collect_os).and_return(:aix)
|
176
|
+
allow(plugin).to receive(:shell_out).with('lslpp -L -q -c').and_return(mock_shell_out(0, stdout, ''))
|
177
|
+
plugin.run
|
178
|
+
end
|
179
|
+
|
180
|
+
it 'calls lslpp -L -q -c' do
|
181
|
+
expect(plugin).to receive(:shell_out)
|
182
|
+
.with('lslpp -L -q -c')
|
183
|
+
.and_return(mock_shell_out(0, stdout, ''))
|
184
|
+
plugin.run
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'gets packages with version' do
|
188
|
+
expect(plugin[:packages]['chef'][:version]).to eq('12.5.1.1')
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
context 'on solaris2' do
|
193
|
+
let(:plugin) { get_plugin('packages') }
|
194
|
+
|
195
|
+
let(:pkglist_output) do
|
196
|
+
File.read(File.join(SPEC_PLUGIN_PATH, 'pkglist.output'))
|
197
|
+
end
|
198
|
+
|
199
|
+
let(:pkginfo_output) do
|
200
|
+
File.read(File.join(SPEC_PLUGIN_PATH, 'pkginfo.output'))
|
201
|
+
end
|
202
|
+
|
203
|
+
before(:each) do
|
204
|
+
allow(plugin).to receive(:collect_os).and_return(:solaris2)
|
205
|
+
allow(plugin).to receive(:shell_out).with('pkg list -H').and_return(mock_shell_out(0, pkglist_output, ''))
|
206
|
+
allow(plugin).to receive(:shell_out).with('pkginfo -l').and_return(mock_shell_out(0, pkginfo_output, ''))
|
207
|
+
plugin.run
|
208
|
+
end
|
209
|
+
|
210
|
+
it 'calls pkg list -H' do
|
211
|
+
expect(plugin).to receive(:shell_out)
|
212
|
+
.with('pkg list -H')
|
213
|
+
.and_return(mock_shell_out(0, pkglist_output, ''))
|
214
|
+
plugin.run
|
215
|
+
end
|
216
|
+
|
217
|
+
it 'calls pkginfo -l' do
|
218
|
+
expect(plugin).to receive(:shell_out)
|
219
|
+
.with('pkginfo -l')
|
220
|
+
.and_return(mock_shell_out(0, pkginfo_output, ''))
|
221
|
+
plugin.run
|
222
|
+
end
|
223
|
+
|
224
|
+
it 'gets ips packages with version' do
|
225
|
+
expect(plugin[:packages]['chef'][:version]).to eq('12.5.1')
|
226
|
+
end
|
227
|
+
|
228
|
+
it 'gets ips packages with version and publisher' do
|
229
|
+
expect(plugin[:packages]['system/EMCpower'][:version]).to eq('6.0.0.1.0-3')
|
230
|
+
expect(plugin[:packages]['system/EMCpower'][:publisher]).to eq('emc.com')
|
231
|
+
end
|
232
|
+
|
233
|
+
it 'gets sysv packages with version' do
|
234
|
+
expect(plugin[:packages]['chef'][:version]).to eq('12.5.1')
|
235
|
+
end
|
236
|
+
|
237
|
+
it 'gets sysv packages with version' do
|
238
|
+
expect(plugin[:packages]['mqm'][:version]).to eq('7.0.1.4')
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|