diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-10-31 16:32:44 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-10-31 16:54:28 -0700 |
commit | c42d57d03c795771ecc04cad3eb4118ae773818a (patch) | |
tree | b4a0c9d30d20940fdf8d543c474037e9ff5c278a | |
parent | 7557513c626fb4f2372a09074e1411b5fc8de64f (diff) | |
download | ohai-c42d57d03c795771ecc04cad3eb4118ae773818a.tar.gz |
Minor memory optimizations
Shave a bit more memory usage off Ohai
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/ohai/plugins/elixir.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/eucalyptus.rb | 4 | ||||
-rw-r--r-- | lib/ohai/plugins/filesystem.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/go.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/groovy.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/lua.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/mono.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/nodejs.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/perl.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/php.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/powershell.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/python.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/rust.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/shard.rb | 2 |
14 files changed, 16 insertions, 14 deletions
diff --git a/lib/ohai/plugins/elixir.rb b/lib/ohai/plugins/elixir.rb index 233a9b9d..abf2f618 100644 --- a/lib/ohai/plugins/elixir.rb +++ b/lib/ohai/plugins/elixir.rb @@ -15,7 +15,7 @@ Ohai.plugin(:Elixir) do provides "languages/elixir" - depends "languages" + depends "languages".freeze collect_data do diff --git a/lib/ohai/plugins/eucalyptus.rb b/lib/ohai/plugins/eucalyptus.rb index 31d69c2d..25f995ea 100644 --- a/lib/ohai/plugins/eucalyptus.rb +++ b/lib/ohai/plugins/eucalyptus.rb @@ -29,6 +29,8 @@ Ohai.plugin(:Eucalyptus) do 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" } } @@ -43,7 +45,7 @@ Ohai.plugin(:Eucalyptus) do 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 diff --git a/lib/ohai/plugins/filesystem.rb b/lib/ohai/plugins/filesystem.rb index 4d8c7ce1..5049e1bd 100644 --- a/lib/ohai/plugins/filesystem.rb +++ b/lib/ohai/plugins/filesystem.rb @@ -24,7 +24,7 @@ # Ohai.plugin(:Filesystem) do - provides "filesystem" + provides "filesystem".freeze def find_device(name) %w{/dev /dev/mapper}.each do |dir| diff --git a/lib/ohai/plugins/go.rb b/lib/ohai/plugins/go.rb index 65eb23c8..8c1ccbc2 100644 --- a/lib/ohai/plugins/go.rb +++ b/lib/ohai/plugins/go.rb @@ -15,7 +15,7 @@ Ohai.plugin(:Go) do provides "languages/go" - depends "languages" + depends "languages".freeze collect_data do diff --git a/lib/ohai/plugins/groovy.rb b/lib/ohai/plugins/groovy.rb index 7b4134ff..a9d2024d 100644 --- a/lib/ohai/plugins/groovy.rb +++ b/lib/ohai/plugins/groovy.rb @@ -18,7 +18,7 @@ Ohai.plugin(:Groovy) do provides "languages/groovy" - depends "languages" + depends "languages".freeze collect_data do diff --git a/lib/ohai/plugins/lua.rb b/lib/ohai/plugins/lua.rb index 94379ba0..6abf7c9c 100644 --- a/lib/ohai/plugins/lua.rb +++ b/lib/ohai/plugins/lua.rb @@ -18,7 +18,7 @@ Ohai.plugin(:Lua) do provides "languages/lua" - depends "languages" + depends "languages".freeze collect_data do diff --git a/lib/ohai/plugins/mono.rb b/lib/ohai/plugins/mono.rb index e7b2483b..1666a294 100644 --- a/lib/ohai/plugins/mono.rb +++ b/lib/ohai/plugins/mono.rb @@ -18,7 +18,7 @@ Ohai.plugin(:Mono) do provides "languages/mono" - depends "languages" + depends "languages".freeze collect_data do diff --git a/lib/ohai/plugins/nodejs.rb b/lib/ohai/plugins/nodejs.rb index a24a0454..136ce1ba 100644 --- a/lib/ohai/plugins/nodejs.rb +++ b/lib/ohai/plugins/nodejs.rb @@ -18,7 +18,7 @@ Ohai.plugin(:Nodejs) do provides "languages/nodejs" - depends "languages" + depends "languages".freeze collect_data do diff --git a/lib/ohai/plugins/perl.rb b/lib/ohai/plugins/perl.rb index 6654a84c..dcfdcee1 100644 --- a/lib/ohai/plugins/perl.rb +++ b/lib/ohai/plugins/perl.rb @@ -18,7 +18,7 @@ Ohai.plugin(:Perl) do provides "languages/perl" - depends "languages" + depends "languages".freeze collect_data do diff --git a/lib/ohai/plugins/php.rb b/lib/ohai/plugins/php.rb index f9ecf917..5b86534b 100644 --- a/lib/ohai/plugins/php.rb +++ b/lib/ohai/plugins/php.rb @@ -20,7 +20,7 @@ Ohai.plugin(:PHP) do provides "languages/php" - depends "languages" + depends "languages".freeze collect_data do diff --git a/lib/ohai/plugins/powershell.rb b/lib/ohai/plugins/powershell.rb index 9ebd2c13..7e611aba 100644 --- a/lib/ohai/plugins/powershell.rb +++ b/lib/ohai/plugins/powershell.rb @@ -17,7 +17,7 @@ Ohai.plugin(:Powershell) do provides "languages/powershell" - depends "languages" + depends "languages".freeze collect_data(:windows) do diff --git a/lib/ohai/plugins/python.rb b/lib/ohai/plugins/python.rb index a82ac57e..762a4776 100644 --- a/lib/ohai/plugins/python.rb +++ b/lib/ohai/plugins/python.rb @@ -19,7 +19,7 @@ Ohai.plugin(:Python) do provides "languages/python" - depends "languages" + depends "languages".freeze collect_data do diff --git a/lib/ohai/plugins/rust.rb b/lib/ohai/plugins/rust.rb index 6cd70d78..460e91b1 100644 --- a/lib/ohai/plugins/rust.rb +++ b/lib/ohai/plugins/rust.rb @@ -15,7 +15,7 @@ Ohai.plugin(:Rust) do provides "languages/rust" - depends "languages" + depends "languages".freeze collect_data do diff --git a/lib/ohai/plugins/shard.rb b/lib/ohai/plugins/shard.rb index bfd07212..92619b3e 100644 --- a/lib/ohai/plugins/shard.rb +++ b/lib/ohai/plugins/shard.rb @@ -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| |