Skip to content

Commit

Permalink
Merge pull request #1553 from chef/memory
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Smith <[email protected]>
  • Loading branch information
tas50 authored Nov 2, 2020
2 parents 7557513 + 459a00a commit e0253e8
Show file tree
Hide file tree
Showing 16 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion lib/ohai/plugins/elixir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

Ohai.plugin(:Elixir) do
provides "languages/elixir"
depends "languages"
depends "languages".freeze

collect_data do

Expand Down
4 changes: 3 additions & 1 deletion lib/ohai/plugins/eucalyptus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
provides "eucalyptus"
depends "network/interfaces"

MAC_MATCH = /^[dD]0:0[dD]:/.freeze

# returns the mac address from the collection of all address types
def get_mac_address(addresses)
detected_addresses = addresses.detect { |address, keypair| keypair == { "family" => "lladdr" } }
Expand All @@ -43,7 +45,7 @@ def get_mac_address(addresses)
def has_euca_mac?
network[:interfaces].each_value do |iface|
mac = get_mac_address(iface[:addresses])
if /^[dD]0:0[dD]:/.match?(mac)
if MAC_MATCH.match?(mac)
logger.trace("Plugin Eucalyptus: has_euca_mac? == true (#{mac})")
return true
end
Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/filesystem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#

Ohai.plugin(:Filesystem) do
provides "filesystem"
provides "filesystem".freeze

def find_device(name)
%w{/dev /dev/mapper}.each do |dir|
Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/go.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

Ohai.plugin(:Go) do
provides "languages/go"
depends "languages"
depends "languages".freeze

collect_data do

Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/groovy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

Ohai.plugin(:Groovy) do
provides "languages/groovy"
depends "languages"
depends "languages".freeze

collect_data do

Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/lua.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

Ohai.plugin(:Lua) do
provides "languages/lua"
depends "languages"
depends "languages".freeze

collect_data do

Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/mono.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

Ohai.plugin(:Mono) do
provides "languages/mono"
depends "languages"
depends "languages".freeze

collect_data do

Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/nodejs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

Ohai.plugin(:Nodejs) do
provides "languages/nodejs"
depends "languages"
depends "languages".freeze

collect_data do

Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/perl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

Ohai.plugin(:Perl) do
provides "languages/perl"
depends "languages"
depends "languages".freeze

collect_data do

Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/php.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

Ohai.plugin(:PHP) do
provides "languages/php"
depends "languages"
depends "languages".freeze

collect_data do

Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/powershell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

Ohai.plugin(:Powershell) do
provides "languages/powershell"
depends "languages"
depends "languages".freeze

collect_data(:windows) do

Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/python.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Ohai.plugin(:Python) do
provides "languages/python"

depends "languages"
depends "languages".freeze

collect_data do

Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/rackspace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# true:: If kernel name matches
# false:: Otherwise
def has_rackspace_kernel?
kernel[:release].split("-").last.eql?("rscloud")
kernel[:release].end_with?("-rscloud")
end

# Checks for rackspace provider attribute
Expand Down
5 changes: 3 additions & 2 deletions lib/ohai/plugins/ruby.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
#
# Author:: Adam Jacob (<[email protected]>)
# Copyright:: Copyright (c) Chef Software Inc.
Expand Down Expand Up @@ -48,13 +49,13 @@ def run_ruby(command)
}

# Create a query string from above hash
env_string = ""
env_string = []
values.each_key do |v|
env_string << "#{v}=\#{#{values[v]}},"
end

# Query the system ruby
result = run_ruby "require 'rubygems'; puts %Q(#{env_string})"
result = run_ruby "require 'rubygems'; puts %Q(#{env_string.join})"

# Parse results to plugin hash
result.split(",").each do |entry|
Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/rust.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

Ohai.plugin(:Rust) do
provides "languages/rust"
depends "languages"
depends "languages".freeze

collect_data do

Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/shard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

Ohai.plugin(:ShardSeed) do
depends "hostname", "dmi", "machine_id", "machinename", "fips", "hardware", "kernel"
provides "shard_seed"
provides "shard_seed".freeze

def get_dmi_property(dmi, thing)
%w{system base_board chassis}.each do |section|
Expand Down

0 comments on commit e0253e8

Please sign in to comment.