summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2017-05-09 07:54:03 -0700
committerGitHub <noreply@github.com>2017-05-09 07:54:03 -0700
commit3f59946f198bf25726061a49126f23586c7a06e0 (patch)
tree28018556198dc78d0e1e5db3c33a73e311153569
parente6f91ac584344bb0c70c3b5768825b253d7967e2 (diff)
parente29a222d4f480596970ff8d5b96b6295dd19606d (diff)
downloadohai-8.24.0.tar.gz
Merge pull request #998 from chef/backportsv8.24.0
Additional backports + Release 8.24.0
-rw-r--r--CHANGELOG.md15
-rw-r--r--Gemfile2
-rw-r--r--lib/ohai/config.rb2
-rw-r--r--lib/ohai/loader.rb2
-rw-r--r--lib/ohai/plugins/linux/mdadm.rb13
-rw-r--r--lib/ohai/version.rb2
-rw-r--r--spec/unit/loader_spec.rb2
-rw-r--r--spec/unit/plugins/linux/mdadm_spec.rb6
8 files changed, 35 insertions, 9 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9b681a41..7f4ef306 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,19 @@
# Change Log
-## [8.23.0](https://github.com/chef/ohai/tree/8.23.0) (2017-01-23)
+## [8.24.0](https://github.com/chef/ohai/tree/v8.24.0) (2017-05-08)
+
+[Full Changelog](https://github.com/chef/ohai/compare/v8.23.0...v8.24.0)
+
+- base: Load additional ohai plugins from /etc/chef/ohai/plugins or C:\chef\ohai\plugins\
+- ec2: Poll EC2 metadata from the new 2016 metadata API versions [#992](https://github.com/chef/ohai/pull/992) ([tas50](https://github.com/tas50))
+- mdadm: Add a new 'members' attribute for member devices in the array [#989](https://github.com/chef/ohai/pull/989) ([jaymzh](https://github.com/jaymzh))
+- dmi: Add DMI type 40,41, and 42 from the latest man page [#969](https://github.com/chef/ohai/pull/969) ([tas50](https://github.com/tas50))
+- ec2: Gather availability_zone and region data [#964](https://github.com/chef/ohai/pull/964) ([webframp](https://github.com/webframp))
+- scala: Fix scala detection when version output contains a warning [#959](https://github.com/chef/ohai/pull/959) ([tas50](https://github.com/tas50))
+- lua: Fix lua detection on new versions of lua [#958](https://github.com/chef/ohai/pull/958) ([tas50](https://github.com/tas50))
+- dmi: Rescue exception in DMI plugin to improve debug logs [#952](https://github.com/chef/ohai/pull/952) ([tas50](https://github.com/tas50))
+
+## [v8.23.0](https://github.com/chef/ohai/tree/v8.23.0) (2017-01-24)
[Full Changelog](https://github.com/chef/ohai/compare/v8.22.1...v8.23.0)
diff --git a/Gemfile b/Gemfile
index 4bcd5f6d..aebcfd92 100644
--- a/Gemfile
+++ b/Gemfile
@@ -5,7 +5,7 @@ gemspec
group :development do
gem "sigar", :platform => "ruby"
- gem "chefstyle"
+ gem "chefstyle", "0.4.0"
gem "overcommit", ">= 0.34.1"
gem "pry-byebug"
gem "pry-stack_explorer"
diff --git a/lib/ohai/config.rb b/lib/ohai/config.rb
index f7e1f518..3722f848 100644
--- a/lib/ohai/config.rb
+++ b/lib/ohai/config.rb
@@ -47,7 +47,7 @@ module Ohai
end
def default_plugin_path
- [ File.expand_path(File.join(File.dirname(__FILE__), "plugins")) ]
+ [ File.expand_path(File.join(File.dirname(__FILE__), "plugins")), ChefConfig::Config.platform_specific_path("/etc/chef/ohai/plugins") ]
end
end
diff --git a/lib/ohai/loader.rb b/lib/ohai/loader.rb
index 0468a6de..8ecd3192 100644
--- a/lib/ohai/loader.rb
+++ b/lib/ohai/loader.rb
@@ -40,7 +40,7 @@ module Ohai
# Finds all the *.rb files under the configured paths in :plugin_path
def self.find_all_in(plugin_dir)
unless Dir.exist?(plugin_dir)
- Ohai::Log.warn("The plugin path #{plugin_dir} does not exist. Skipping...")
+ Ohai::Log.info("The plugin path #{plugin_dir} does not exist. Skipping...")
return []
end
diff --git a/lib/ohai/plugins/linux/mdadm.rb b/lib/ohai/plugins/linux/mdadm.rb
index 0075750a..7133913a 100644
--- a/lib/ohai/plugins/linux/mdadm.rb
+++ b/lib/ohai/plugins/linux/mdadm.rb
@@ -1,6 +1,8 @@
#
# Author:: Tim Smith <tsmith@limelight.com>
+# Author:: Phil Dibowitz <phild@ipomc.com>
# Copyright:: Copyright (c) 2013-2014, Limelight Networks, Inc.
+# Copyright:: Copyright (c) 2017 Facebook, Inc.
# Plugin:: mdadm
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -52,15 +54,19 @@ Ohai.plugin(:Mdadm) do
collect_data(:linux) do
# gather a list of all raid arrays
if File.exist?("/proc/mdstat")
- devices = []
+ devices = {}
File.open("/proc/mdstat").each do |line|
- devices << Regexp.last_match[1] if line =~ /(md[0-9]+)/
+ if line =~ /(md[0-9]+)/
+ device = Regexp.last_match[1]
+ pieces = line.split(/\s+/)
+ devices[device] = pieces[4..-1].map { |s| s.match(/(.+)\[\d\]/)[1] }
+ end
end
# create the mdadm mash and gather individual information if devices are present
unless devices.empty?
mdadm Mash.new
- devices.sort.each do |device|
+ devices.keys.sort.each do |device|
mdadm[device] = Mash.new
# gather detailed information on the array
@@ -68,6 +74,7 @@ Ohai.plugin(:Mdadm) do
# if the mdadm command was sucessful pass so.stdout to create_raid_device_mash to grab the tidbits we want
mdadm[device] = create_raid_device_mash(so.stdout) if so.stdout
+ mdadm[device]["members"] = devices[device]
end
end
end
diff --git a/lib/ohai/version.rb b/lib/ohai/version.rb
index 235639b0..f7eb9381 100644
--- a/lib/ohai/version.rb
+++ b/lib/ohai/version.rb
@@ -18,5 +18,5 @@
module Ohai
OHAI_ROOT = File.expand_path(File.dirname(__FILE__))
- VERSION = "8.23.0"
+ VERSION = "8.24.0"
end
diff --git a/spec/unit/loader_spec.rb b/spec/unit/loader_spec.rb
index bfe2aa83..7ee9bd1a 100644
--- a/spec/unit/loader_spec.rb
+++ b/spec/unit/loader_spec.rb
@@ -222,7 +222,7 @@ EOF
describe "when plugin directory does not exist" do
it "logs an invalid plugin path warning" do
- expect(Ohai::Log).to receive(:warn).with(/The plugin path.*does not exist/)
+ expect(Ohai::Log).to receive(:info).with(/The plugin path.*does not exist/)
allow(Dir).to receive(:exist?).with("/bogus/dir").and_return(false)
Ohai::Loader::PluginFile.find_all_in("/bogus/dir")
end
diff --git a/spec/unit/plugins/linux/mdadm_spec.rb b/spec/unit/plugins/linux/mdadm_spec.rb
index 2e8b533d..a2f0403f 100644
--- a/spec/unit/plugins/linux/mdadm_spec.rb
+++ b/spec/unit/plugins/linux/mdadm_spec.rb
@@ -99,6 +99,12 @@ MD
end
end
+ it "should detect member devies" do
+ @plugin.run
+ expect(@plugin[:mdadm][:md0][:members].sort).to eq(
+ %w{sdc sdd sde sdf sdg sdh}
+ )
+ end
end
end