summaryrefslogtreecommitdiff
path: root/lib/ohai/plugins/solaris2
diff options
context:
space:
mode:
authorClaire McQuin <claire@opscode.com>2013-10-03 17:29:03 -0700
committerClaire McQuin <claire@opscode.com>2013-10-17 12:07:30 -0700
commite456e5e91f58c13101ee1631b9def808f27efd5a (patch)
tree08995ef8ae50850f928418ac6234238eb8607713 /lib/ohai/plugins/solaris2
parentb9f197ceb3c377b1f0e7c269252ea1c8757d35c1 (diff)
downloadohai-e456e5e91f58c13101ee1631b9def808f27efd5a.tar.gz
update plugin files
Diffstat (limited to 'lib/ohai/plugins/solaris2')
-rw-r--r--lib/ohai/plugins/solaris2/dmi.rb4
-rw-r--r--lib/ohai/plugins/solaris2/filesystem.rb4
-rw-r--r--lib/ohai/plugins/solaris2/kernel.rb41
-rw-r--r--lib/ohai/plugins/solaris2/network.rb11
-rw-r--r--lib/ohai/plugins/solaris2/platform.rb8
-rw-r--r--lib/ohai/plugins/solaris2/ps.rb27
-rw-r--r--lib/ohai/plugins/solaris2/uptime.rb38
-rw-r--r--lib/ohai/plugins/solaris2/virtualization.rb4
-rw-r--r--lib/ohai/plugins/solaris2/zpools.rb4
9 files changed, 19 insertions, 122 deletions
diff --git a/lib/ohai/plugins/solaris2/dmi.rb b/lib/ohai/plugins/solaris2/dmi.rb
index c3010771..8308bc78 100644
--- a/lib/ohai/plugins/solaris2/dmi.rb
+++ b/lib/ohai/plugins/solaris2/dmi.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-Ohai.plugin do
+Ohai.plugin(:DMI) do
depends "dmi"
- collect_data do
+ collect_data(:solaris2) do
# if we already have a "dmi" with keys (presumably from dmidecode), don't try smbios
# note that a single key just means dmidecode exited with its version
if (dmi.class.to_s == 'Mash') and (dmi.keys.length > 1)
diff --git a/lib/ohai/plugins/solaris2/filesystem.rb b/lib/ohai/plugins/solaris2/filesystem.rb
index 0d73ff4b..2bf5e505 100644
--- a/lib/ohai/plugins/solaris2/filesystem.rb
+++ b/lib/ohai/plugins/solaris2/filesystem.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-Ohai.plugin do
+Ohai.plugin(:Filesystem) do
provides "filesystem"
- collect_data do
+ collect_data(:solaris2) do
fs = Mash.new
# Grab filesystem data from df
diff --git a/lib/ohai/plugins/solaris2/kernel.rb b/lib/ohai/plugins/solaris2/kernel.rb
deleted file mode 100644
index 9e14f458..00000000
--- a/lib/ohai/plugins/solaris2/kernel.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# Author:: Benjamin Black (<nostromo@gmail.com>)
-# Copyright:: Copyright (c) 2009 Opscode, Inc.
-# License:: Apache License, Version 2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-Ohai.plugin do
- provides "kernel/os"
-
- collect_data do
- so = shell_out("uname -s")
- kernel[:os] = so.stdout.split($/)[0]
-
- modules = Mash.new
-
- so = shell_out("modinfo")
- # EXAMPLE:
- # Id Loadaddr Size Info Rev Module Name
- # 6 1180000 4623 1 1 specfs (filesystem for specfs)
- module_description = /[\s]*([\d]+)[\s]+([a-f\d]+)[\s]+([a-f\d]+)[\s]+(?:[\-\d]+)[\s]+(?:[\d]+)[\s]+([\S]+)[\s]+\((.+)\)$/
- so.stdout.lines do |line|
- if mod = module_description.match(line)
- modules[mod[4]] = { :id => mod[1].to_i, :loadaddr => mod[2], :size => mod[3].to_i(16), :description => mod[5]}
- end
- end
-
- kernel[:modules] = modules
- end
-end
diff --git a/lib/ohai/plugins/solaris2/network.rb b/lib/ohai/plugins/solaris2/network.rb
index 2cf3907d..6a69b4a6 100644
--- a/lib/ohai/plugins/solaris2/network.rb
+++ b/lib/ohai/plugins/solaris2/network.rb
@@ -53,10 +53,9 @@
# srcof qfe1
# inet6 fe80::203:baff:fe17:4444/128
-require 'scanf'
-
-Ohai.plugin do
- provides "network"
+Ohai.plugin(:Network) do
+ provides "network", "network/interfaces"
+ provides "counters/network", "counters/network/interfaces"
def encaps_lookup(ifname)
return "Ethernet" if ifname.eql?("e1000g")
@@ -74,7 +73,9 @@ Ohai.plugin do
nil
end
- collect_data do
+ collect_data(:solaris2) do
+ require 'scanf'
+
iface = Mash.new
network Mash.new unless network
network[:interfaces] = Mash.new unless network[:interfaces]
diff --git a/lib/ohai/plugins/solaris2/platform.rb b/lib/ohai/plugins/solaris2/platform.rb
index a9172fcd..ea10e7a8 100644
--- a/lib/ohai/plugins/solaris2/platform.rb
+++ b/lib/ohai/plugins/solaris2/platform.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-Ohai.plugin do
- provides "platform", "platform_version", "platform_build"
+Ohai.plugin(:Platform) do
+ provides "platform", "platform_version", "platform_build", "platform_family"
- collect_data do
+ collect_data(:solaris2) do
if File.exists?("/sbin/uname")
uname_exec = "/sbin/uname"
else
@@ -59,5 +59,7 @@ Ohai.plugin do
end
end
end
+
+ platform_family platform
end
end
diff --git a/lib/ohai/plugins/solaris2/ps.rb b/lib/ohai/plugins/solaris2/ps.rb
deleted file mode 100644
index 51e4e44f..00000000
--- a/lib/ohai/plugins/solaris2/ps.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Author:: Adam Jacob (<adam@opscode.com>)
-# Copyright:: Copyright (c) 2008 Opscode, Inc.
-# License:: Apache License, Version 2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-Ohai.plugin do
- provides "command/ps"
-
- depends 'command'
-
- collect_data do
- command[:ps] = 'ps -ef'
- end
-end
diff --git a/lib/ohai/plugins/solaris2/uptime.rb b/lib/ohai/plugins/solaris2/uptime.rb
deleted file mode 100644
index e44632b9..00000000
--- a/lib/ohai/plugins/solaris2/uptime.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Author:: Kurt Yoder (<ktyopscode@yoderhome.com>)
-# Copyright:: Copyright (c) 2008 Opscode, Inc.
-# License:: Apache License, Version 2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-require 'date'
-# It would be far better if we could include sys/uptime from sys-uptime RubyGem
-# It would also be good if we could pull idle time; how do we do this on Solaris?
-
-Ohai.plugin do
- provides "uptime", "uptime_seconds"
-
- collect_data do
- # Example output:
- # $ who -b
- # . system boot Jul 9 17:51
- so = shell_out("who -b")
- so.stdout.lines do |line|
- if line =~ /.* boot (.+)/
- uptime_seconds Time.now.to_i - DateTime.parse($1).strftime('%s').to_i
- uptime seconds_to_human(uptime_seconds)
- break
- end
- end
- end
-end
diff --git a/lib/ohai/plugins/solaris2/virtualization.rb b/lib/ohai/plugins/solaris2/virtualization.rb
index ec38fd64..af3ea7c1 100644
--- a/lib/ohai/plugins/solaris2/virtualization.rb
+++ b/lib/ohai/plugins/solaris2/virtualization.rb
@@ -18,10 +18,10 @@
# limitations under the License.
#
-Ohai.plugin do
+Ohai.plugin(:Virtualization) do
provides "virtualization"
- collect_data do
+ collect_data(:solaris2) do
virtualization Mash.new
# Detect KVM/QEMU from cpuinfo, report as KVM
diff --git a/lib/ohai/plugins/solaris2/zpools.rb b/lib/ohai/plugins/solaris2/zpools.rb
index e6f6e469..f0867cd5 100644
--- a/lib/ohai/plugins/solaris2/zpools.rb
+++ b/lib/ohai/plugins/solaris2/zpools.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-Ohai.plugin do
+Ohai.plugin(:Zpools) do
provides "zpools"
- collect_data do
+ collect_data(:solaris2) do
pools = Mash.new
# Grab ZFS zpools overall health and attributes