summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-11-23 08:42:58 -0800
committerTim Smith <tsmith84@gmail.com>2020-11-23 08:47:34 -0800
commit31ea4c57c01f810622a95186677ced222d7faca2 (patch)
treed59bb011d7cd747fa13345bd3e405421c68d43d1
parenta0ac22ca5a5561bdb44e05e00c87babacb158b4a (diff)
downloadohai-31ea4c57c01f810622a95186677ced222d7faca2.tar.gz
Misc RuboCop cleanup of the codebase
A few misc things Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/ohai/dsl/plugin.rb2
-rw-r--r--lib/ohai/dsl/plugin/versionvii.rb2
-rw-r--r--lib/ohai/mixin/azure_metadata.rb4
-rw-r--r--lib/ohai/mixin/ec2_metadata.rb12
-rw-r--r--lib/ohai/mixin/gce_metadata.rb2
-rw-r--r--lib/ohai/plugins/aix/network.rb7
-rw-r--r--lib/ohai/plugins/cloud.rb2
-rw-r--r--lib/ohai/plugins/cpu.rb38
-rw-r--r--lib/ohai/plugins/darwin/network.rb14
-rw-r--r--lib/ohai/plugins/dmi.rb8
-rw-r--r--lib/ohai/plugins/kernel.rb2
-rw-r--r--lib/ohai/plugins/libvirt.rb4
-rw-r--r--lib/ohai/plugins/linux/network.rb2
-rw-r--r--lib/ohai/plugins/network.rb2
-rw-r--r--lib/ohai/plugins/passwd.rb2
-rw-r--r--lib/ohai/plugins/rackspace.rb4
-rw-r--r--lib/ohai/plugins/solaris2/network.rb2
-rw-r--r--lib/ohai/plugins/solaris2/virtualization.rb3
-rw-r--r--lib/ohai/plugins/train.rb1
-rw-r--r--lib/ohai/plugins/zpools.rb1
-rw-r--r--lib/ohai/util/ip_helper.rb2
-rw-r--r--ohai.gemspec2
-rw-r--r--spec/unit/plugins/aix/network_spec.rb26
-rw-r--r--spec/unit/plugins/c_spec.rb1
-rw-r--r--spec/unit/plugins/chef_spec.rb1
-rw-r--r--spec/unit/plugins/docker_spec.rb13
-rw-r--r--spec/unit/plugins/linux/network_spec.rb2
-rw-r--r--spec/unit/plugins/linux/selinux_spec.rb52
-rw-r--r--spec/unit/plugins/packages_spec.rb8
-rw-r--r--spec/unit/plugins/shard_spec.rb2
-rw-r--r--spec/unit/plugins/solaris2/network_spec.rb2
31 files changed, 108 insertions, 117 deletions
diff --git a/lib/ohai/dsl/plugin.rb b/lib/ohai/dsl/plugin.rb
index cc561d36..48d49a57 100644
--- a/lib/ohai/dsl/plugin.rb
+++ b/lib/ohai/dsl/plugin.rb
@@ -218,7 +218,7 @@ module Ohai
def safe_get_attribute(*keys)
keys.inject(@data) do |attrs, key|
unless attrs.nil? || attrs.is_a?(Array) || attrs.is_a?(Hash)
- raise TypeError.new("Expected Hash but got #{attrs.class}.")
+ raise TypeError, "Expected Hash but got #{attrs.class}."
end
attrs[key]
diff --git a/lib/ohai/dsl/plugin/versionvii.rb b/lib/ohai/dsl/plugin/versionvii.rb
index 6386c2ed..f623ba1e 100644
--- a/lib/ohai/dsl/plugin/versionvii.rb
+++ b/lib/ohai/dsl/plugin/versionvii.rb
@@ -195,8 +195,6 @@ module Ohai
# key? to avoid falsely instantiating a configuration hash.
if Ohai.config[:plugin].key?(snake_case_name)
Ohai.config[:plugin][snake_case_name]
- else
- nil
end
end
end
diff --git a/lib/ohai/mixin/azure_metadata.rb b/lib/ohai/mixin/azure_metadata.rb
index 65b26e8b..7bf17ec9 100644
--- a/lib/ohai/mixin/azure_metadata.rb
+++ b/lib/ohai/mixin/azure_metadata.rb
@@ -36,8 +36,8 @@ module Ohai
# it's important that the newer versions are at the end of this array so we can skip sorting it
AZURE_SUPPORTED_VERSIONS ||= %w{ 2017-04-02 2017-08-01 2017-12-01 2018-02-01 2018-04-02
- 2018-10-01 2019-02-01 2019-03-11 2019-04-30 2019-06-01
- 2019-06-04 2019-08-01 2019-08-15 2019-11-01 }.freeze
+ 2018-10-01 2019-02-01 2019-03-11 2019-04-30 2019-06-01
+ 2019-06-04 2019-08-01 2019-08-15 2019-11-01 }.freeze
def best_api_version
@api_version ||= begin
diff --git a/lib/ohai/mixin/ec2_metadata.rb b/lib/ohai/mixin/ec2_metadata.rb
index 45150f40..72894170 100644
--- a/lib/ohai/mixin/ec2_metadata.rb
+++ b/lib/ohai/mixin/ec2_metadata.rb
@@ -42,8 +42,8 @@ module Ohai
EC2_METADATA_ADDR ||= "169.254.169.254"
EC2_SUPPORTED_VERSIONS ||= %w{ 1.0 2007-01-19 2007-03-01 2007-08-29 2007-10-10 2007-12-15
- 2008-02-01 2008-09-01 2009-04-04 2011-01-01 2011-05-01 2012-01-12
- 2014-02-25 2014-11-05 2015-10-20 2016-04-19 2016-06-30 2016-09-02 }.freeze
+ 2008-02-01 2008-09-01 2009-04-04 2011-01-01 2011-05-01 2012-01-12
+ 2014-02-25 2014-11-05 2015-10-20 2016-04-19 2016-06-30 2016-09-02 }.freeze
EC2_ARRAY_VALUES ||= %w{security-groups local_ipv4s}.freeze
EC2_ARRAY_DIR ||= %w{network/interfaces/macs}.freeze
EC2_JSON_DIR ||= %w{iam}.freeze
@@ -58,7 +58,7 @@ module Ohai
elsif response.code != "200"
raise "Mixin EC2: Unable to determine EC2 metadata version (returned #{response.code} response)"
end
- # Note: Sorting the list of versions may have unintended consequences in
+ # NOTE: Sorting the list of versions may have unintended consequences in
# non-EC2 environments. It appears to be safe in EC2 as of 2013-04-12.
versions = response.body.split("\n").sort
until versions.empty? || EC2_SUPPORTED_VERSIONS.include?(versions.last)
@@ -119,7 +119,7 @@ module Ohai
else
metadata_get(key, best_api_version)
end
- elsif (not key.eql?(id)) && (not key.eql?("/"))
+ elsif (!key.eql?(id)) && (!key.eql?("/"))
name = key[0..-2]
sym = metadata_key(name)
if EC2_ARRAY_DIR.include?(name)
@@ -144,7 +144,7 @@ module Ohai
if key[-1..-1] != "/"
retr_meta = metadata_get("#{id}#{key}", api_version)
metadata[metadata_key(key)] = retr_meta || ""
- elsif not key.eql?("/")
+ elsif !key.eql?("/")
metadata[key[0..-2]] = fetch_dir_metadata("#{id}#{key}", api_version)
end
end
@@ -164,7 +164,7 @@ module Ohai
json = String(data)
parser = FFI_Yajl::Parser.new
metadata[metadata_key(key)] = parser.parse(json)
- elsif not key.eql?("/")
+ elsif !key.eql?("/")
metadata[key[0..-2]] = fetch_json_dir_metadata("#{id}#{key}", api_version)
end
end
diff --git a/lib/ohai/mixin/gce_metadata.rb b/lib/ohai/mixin/gce_metadata.rb
index 8ea838aa..64b35f92 100644
--- a/lib/ohai/mixin/gce_metadata.rb
+++ b/lib/ohai/mixin/gce_metadata.rb
@@ -72,7 +72,7 @@ module Ohai
#
# @return [Boolean] is there a trailing /?
def has_trailing_slash?(data)
- !! ( data =~ %r{/$} )
+ !!( data =~ %r{/$} )
end
def sanitize_key(key)
diff --git a/lib/ohai/plugins/aix/network.rb b/lib/ohai/plugins/aix/network.rb
index cb40e09a..a31ecc4f 100644
--- a/lib/ohai/plugins/aix/network.rb
+++ b/lib/ohai/plugins/aix/network.rb
@@ -72,7 +72,8 @@ Ohai.plugin(:Network) do
else
# We have key value pairs.
if line =~ %r{inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(/(\d{1,2}))?}
- tmp_addr, tmp_prefix = $1, $3
+ tmp_addr = $1
+ tmp_prefix = $3
if tmp_prefix.nil?
netmask = hex_to_dec_netmask($1) if line =~ /netmask\s0x(\S+)\s/
unless netmask
@@ -90,7 +91,7 @@ Ohai.plugin(:Network) do
ifaces[int_name][:addresses][tmp_addr][:broadcast] = $1
end
elsif line =~ %r{inet6 ([a-f0-9\:]+)%?(\d*)/?(\d*)?}
- # TODO do we have more properties on inet6 in aix? broadcast
+ # TODO: do we have more properties on inet6 in aix? broadcast
ifaces[int_name][:addresses] ||= Mash.new
ifaces[int_name][:addresses][$1] = { "family" => "inet6", "zone_index" => $2, "prefixlen" => $3 }
else
@@ -119,7 +120,7 @@ Ohai.plugin(:Network) do
interface = $6
ifaces[interface][:routes] ||= []
ifaces[interface][:routes] << Mash.new( destination: $1, family: family,
- via: $2, flags: $3)
+ via: $2, flags: $3)
end
end
end
diff --git a/lib/ohai/plugins/cloud.rb b/lib/ohai/plugins/cloud.rb
index a49044fb..14e1e454 100644
--- a/lib/ohai/plugins/cloud.rb
+++ b/lib/ohai/plugins/cloud.rb
@@ -110,7 +110,7 @@ Ohai.plugin(:Cloud) do
ipaddr = ""
begin
ipaddr = IPAddr.new(ip)
- raise ArgumentError, "not valid #{address_family} address" unless (address_family == :ipv4) ? ipaddr.ipv4? : ipaddr.ipv6?
+ raise ArgumentError, "not valid #{address_family} address" unless address_family == :ipv4 ? ipaddr.ipv4? : ipaddr.ipv6?
rescue ArgumentError => e
raise "ERROR: the ohai 'cloud' plugin failed with an IP address of '#{ip}' : #{e.message}"
end
diff --git a/lib/ohai/plugins/cpu.rb b/lib/ohai/plugins/cpu.rb
index f9e980b7..9232fdf7 100644
--- a/lib/ohai/plugins/cpu.rb
+++ b/lib/ohai/plugins/cpu.rb
@@ -348,25 +348,25 @@ Ohai.plugin(:CPU) do
key = kv.shift
value = kv.join(" ").chomp
case key
- when /chip_id/
- cpu[instance]["socket"] = value
- cpusockets.push(value) if cpusockets.index(value).nil?
- when /cpu_type/
- cpu[instance]["arch"] = value
- when /clock_MHz/
- cpu[instance]["mhz"] = value
- when /brand/
- cpu[instance]["model_name"] = value.sub(/\s+/, " ")
- when /^state$/
- cpu[instance]["state"] = value
- cpu["cpustates"][value] ||= 0
- cpu["cpustates"][value] += 1
- when /core_id/
- cpu[instance]["core_id"] = value
- # Detect hyperthreading/multithreading
- cpucores.push(value) if cpucores.index(value).nil?
- when /family|fpu_type|model|stepping|vendor_id/
- cpu[instance][key] = value
+ when /chip_id/
+ cpu[instance]["socket"] = value
+ cpusockets.push(value) if cpusockets.index(value).nil?
+ when /cpu_type/
+ cpu[instance]["arch"] = value
+ when /clock_MHz/
+ cpu[instance]["mhz"] = value
+ when /brand/
+ cpu[instance]["model_name"] = value.sub(/\s+/, " ")
+ when /^state$/
+ cpu[instance]["state"] = value
+ cpu["cpustates"][value] ||= 0
+ cpu["cpustates"][value] += 1
+ when /core_id/
+ cpu[instance]["core_id"] = value
+ # Detect hyperthreading/multithreading
+ cpucores.push(value) if cpucores.index(value).nil?
+ when /family|fpu_type|model|stepping|vendor_id/
+ cpu[instance][key] = value
end
end
cpu["cores"] = cpucores.size
diff --git a/lib/ohai/plugins/darwin/network.rb b/lib/ohai/plugins/darwin/network.rb
index 2d3e2a12..a4440a71 100644
--- a/lib/ohai/plugins/darwin/network.rb
+++ b/lib/ohai/plugins/darwin/network.rb
@@ -41,11 +41,9 @@ Ohai.plugin(:Network) do
else
media[line_array[i]]["options"] = $1.split(",")
end
- else
- if line_array[i].eql?("autoselect")
- media["autoselect"] = {} unless media.key?("autoselect")
- media["autoselect"]["options"] = []
- end
+ elsif line_array[i].eql?("autoselect")
+ media["autoselect"] = {} unless media.key?("autoselect")
+ media["autoselect"]["options"] = []
end
else
media["none"] = { "options" => [] }
@@ -145,15 +143,15 @@ Ohai.plugin(:Network) do
end
if line =~ /\s+inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) netmask 0x(([0-9a-f]){1,8}) broadcast (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/
iface[cint][:addresses] ||= Mash.new
- iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => hex_to_dec_netmask($2) , "broadcast" => $4 }
+ iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => hex_to_dec_netmask($2), "broadcast" => $4 }
end
if line =~ /\s+inet6 ([a-f0-9\:]+)(\s*|(\%[a-z0-9]+)\s*) prefixlen (\d+)\s*/
iface[cint][:addresses] ||= Mash.new
- iface[cint][:addresses][$1] = { "family" => "inet6", "prefixlen" => $4 , "scope" => scope_lookup($1) }
+ iface[cint][:addresses][$1] = { "family" => "inet6", "prefixlen" => $4, "scope" => scope_lookup($1) }
end
if line =~ /\s+inet6 ([a-f0-9\:]+)(\s*|(\%[a-z0-9]+)\s*) prefixlen (\d+) scopeid 0x([a-f0-9]+)/
iface[cint][:addresses] ||= Mash.new
- iface[cint][:addresses][$1] = { "family" => "inet6", "prefixlen" => $4 , "scope" => scope_lookup($1) }
+ iface[cint][:addresses][$1] = { "family" => "inet6", "prefixlen" => $4, "scope" => scope_lookup($1) }
end
if line =~ /^\s+media: ((\w+)|(\w+ [a-zA-Z0-9\-\<\>]+)) status: (\w+)/
iface[cint][:media] ||= Mash.new
diff --git a/lib/ohai/plugins/dmi.rb b/lib/ohai/plugins/dmi.rb
index c9d4ecaf..4208e22e 100644
--- a/lib/ohai/plugins/dmi.rb
+++ b/lib/ohai/plugins/dmi.rb
@@ -93,14 +93,14 @@ Ohai.plugin(:DMI) do
field = nil
elsif ( type = type_line.match(line) )
- if dmi_record .nil?
+ if dmi_record.nil?
logger.trace("Plugin DMI: unexpected data line found before header; discarding:\n#{line}")
next
end
dmi[dmi_record[:type]][:all_records][dmi_record[:position]][:application_identifier] = type[1]
elsif ( data = data_line.match(line) )
- if dmi_record .nil?
+ if dmi_record.nil?
logger.trace("Plugin DMI: unexpected data line found before header; discarding:\n#{line}")
next
end
@@ -108,11 +108,11 @@ Ohai.plugin(:DMI) do
field = data[1]
elsif ( extended_data = extended_data_line.match(line) )
- if dmi_record .nil?
+ if dmi_record.nil?
logger.trace("Plugin DMI: unexpected extended data line found before header; discarding:\n#{line}")
next
end
- if field .nil?
+ if field.nil?
logger.trace("Plugin DMI: unexpected extended data line found outside data section; discarding:\n#{line}")
next
end
diff --git a/lib/ohai/plugins/kernel.rb b/lib/ohai/plugins/kernel.rb
index e96967d6..36ff9d4a 100644
--- a/lib/ohai/plugins/kernel.rb
+++ b/lib/ohai/plugins/kernel.rb
@@ -115,7 +115,6 @@ Ohai.plugin(:Kernel) do
when 16 then "WIN95"
when 17 then "WIN98"
when 19 then "WINCE"
- else nil
end
end
@@ -134,7 +133,6 @@ Ohai.plugin(:Kernel) do
when 6 then "Appliance PC"
when 7 then "Performance Server"
when 8 then "Maximum"
- else nil
end
end
diff --git a/lib/ohai/plugins/libvirt.rb b/lib/ohai/plugins/libvirt.rb
index 15b0fa40..b3bde624 100644
--- a/lib/ohai/plugins/libvirt.rb
+++ b/lib/ohai/plugins/libvirt.rb
@@ -17,11 +17,11 @@
# limitations under the License.
#
-# Note: This plugin requires libvirt-bin/libvirt-dev as well as the ruby-libvirt
+# NOTE: This plugin requires libvirt-bin/libvirt-dev as well as the ruby-libvirt
# gem to be installed before it will properly parse data
Ohai.plugin(:Libvirt) do
- %w{ uri capabilities nodeinfo domains networks storage }.each do |info|
+ %w{uri capabilities nodeinfo domains networks storage}.each do |info|
provides "libvirt/#{info}"
depends "virtualization"
end
diff --git a/lib/ohai/plugins/linux/network.rb b/lib/ohai/plugins/linux/network.rb
index 01f4af47..e32c602c 100644
--- a/lib/ohai/plugins/linux/network.rb
+++ b/lib/ohai/plugins/linux/network.rb
@@ -154,7 +154,7 @@ Ohai.plugin(:Network) do
def ethernet_layer_one(iface)
return iface unless ethtool_binary_path
- keys = %w{ Speed Duplex Port Transceiver Auto-negotiation MDI-X }
+ keys = %w{Speed Duplex Port Transceiver Auto-negotiation MDI-X}
iface.each_key do |tmp_int|
next unless iface[tmp_int][:encapsulation] == "Ethernet"
diff --git a/lib/ohai/plugins/network.rb b/lib/ohai/plugins/network.rb
index be8f26f3..d19c23c0 100644
--- a/lib/ohai/plugins/network.rb
+++ b/lib/ohai/plugins/network.rb
@@ -39,7 +39,7 @@ Ohai.plugin(:NetworkAddresses) do
next if iface_v.nil? || !iface_v.key?("addresses")
iface_v["addresses"].each do |addr, addr_v|
- next if addr_v.nil? || (not addr_v.key? "family") || addr_v["family"] != family
+ next if addr_v.nil? || (!addr_v.key? "family") || addr_v["family"] != family
ipaddresses << {
ipaddress: addr_v["prefixlen"] ? IPAddress("#{addr}/#{addr_v["prefixlen"]}") : IPAddress("#{addr}/#{addr_v["netmask"]}"),
diff --git a/lib/ohai/plugins/passwd.rb b/lib/ohai/plugins/passwd.rb
index a2e33632..aba8c232 100644
--- a/lib/ohai/plugins/passwd.rb
+++ b/lib/ohai/plugins/passwd.rb
@@ -91,7 +91,7 @@ Ohai.plugin(:Passwd) do
if info.keys.any? { |x| x.match?("Win32_UserAccount") }
mi["type"] = :user
else
- # Note: the type here is actually Win32_SystemAccount, because,
+ # NOTE: the type here is actually Win32_SystemAccount, because,
# that's what groups are in the Windows universe.
mi["type"] = :group
end
diff --git a/lib/ohai/plugins/rackspace.rb b/lib/ohai/plugins/rackspace.rb
index 02b06d1a..efe63e40 100644
--- a/lib/ohai/plugins/rackspace.rb
+++ b/lib/ohai/plugins/rackspace.rb
@@ -161,10 +161,10 @@ Ohai.plugin(:Rackspace) do
get_global_ipv6_address(:public_ipv6, :eth0)
unless rackspace[:public_ip].nil?
rackspace[:public_hostname] = begin
- Resolv.getname(rackspace[:public_ip])
+ Resolv.getname(rackspace[:public_ip])
rescue Resolv::ResolvError, Resolv::ResolvTimeout
rackspace[:public_ip]
- end
+ end
end
rackspace[:local_ipv4] = rackspace[:private_ip]
get_global_ipv6_address(:local_ipv6, :eth1)
diff --git a/lib/ohai/plugins/solaris2/network.rb b/lib/ohai/plugins/solaris2/network.rb
index 754a53e7..fb9c5f07 100644
--- a/lib/ohai/plugins/solaris2/network.rb
+++ b/lib/ohai/plugins/solaris2/network.rb
@@ -127,7 +127,7 @@ Ohai.plugin(:Network) do
end
if line =~ /\s+inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) netmask (([0-9a-f]){1,8}) broadcast (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/
iface[cint][:addresses] ||= Mash.new
- iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => hex_to_dec_netmask($2) , "broadcast" => $4 }
+ iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => hex_to_dec_netmask($2), "broadcast" => $4 }
end
if line =~ %r{\s+inet6 ([a-f0-9\:]+)(\s*|(\%[a-z0-9]+)\s*)/(\d+)\s*$}
iface[cint][:addresses] ||= Mash.new
diff --git a/lib/ohai/plugins/solaris2/virtualization.rb b/lib/ohai/plugins/solaris2/virtualization.rb
index 6a7fc2ec..752aad23 100644
--- a/lib/ohai/plugins/solaris2/virtualization.rb
+++ b/lib/ohai/plugins/solaris2/virtualization.rb
@@ -69,12 +69,11 @@ Ohai.plugin(:Virtualization) do
if zones.length == 1
first_zone = zones.keys[0]
+ virtualization[:system] = "zone"
if first_zone == "global"
- virtualization[:system] = "zone"
virtualization[:role] = "host"
virtualization[:systems][:zone] = "host"
else
- virtualization[:system] = "zone"
virtualization[:role] = "guest"
virtualization[:systems][:zone] = "guest"
virtualization[:guest_uuid] = zones[first_zone]["uuid"]
diff --git a/lib/ohai/plugins/train.rb b/lib/ohai/plugins/train.rb
index 6d48c4cc..9f28ba3e 100644
--- a/lib/ohai/plugins/train.rb
+++ b/lib/ohai/plugins/train.rb
@@ -29,7 +29,6 @@ Ohai.plugin(:Train) do
if transport_connection.respond_to?(:uri)
train["scheme"] = URI.parse(transport_connection.uri).scheme
train["uri"] = transport_connection.uri
- else
end
end
end
diff --git a/lib/ohai/plugins/zpools.rb b/lib/ohai/plugins/zpools.rb
index bd6ced99..b2a7d2a4 100644
--- a/lib/ohai/plugins/zpools.rb
+++ b/lib/ohai/plugins/zpools.rb
@@ -46,7 +46,6 @@ Ohai.plugin(:Zpools) do
pools[$1][:zpool_version] = sanitize_value($8)
end
end
-
rescue Ohai::Exceptions::Exec
Ohai::Log.debug('Plugin Zpools: Could not shell_out "zpool list -H -o name,size,alloc,free,cap,dedup,health,version". Skipping plugin.')
end
diff --git a/lib/ohai/util/ip_helper.rb b/lib/ohai/util/ip_helper.rb
index 86617935..044afaec 100644
--- a/lib/ohai/util/ip_helper.rb
+++ b/lib/ohai/util/ip_helper.rb
@@ -33,7 +33,7 @@ module Ohai
IPV6_LINK_LOCAL_UNICAST_BLOCK.include?(ip) || IPV6_PRIVATE_ADDRESS_BLOCK.include?(ip)
end
end
- alias :unique_local_address? :private_address?
+ alias unique_local_address? private_address?
def public_address?(addr)
!private_address?(addr)
diff --git a/ohai.gemspec b/ohai.gemspec
index 854805db..841982d6 100644
--- a/ohai.gemspec
+++ b/ohai.gemspec
@@ -24,8 +24,8 @@ Gem::Specification.new do |s|
s.add_dependency "mixlib-log", ">= 2.0.1", "< 4.0"
s.add_dependency "mixlib-shellout", ">= 2.0", "< 4.0"
s.add_dependency "plist", "~> 3.1"
- s.add_dependency "wmi-lite", "~> 1.0"
s.add_dependency "train-core"
+ s.add_dependency "wmi-lite", "~> 1.0"
# Note for ohai developers: If chef-config causes you grief, try:
# bundle install --with development
# this should work as long as chef is a development dependency in Gemfile.
diff --git a/spec/unit/plugins/aix/network_spec.rb b/spec/unit/plugins/aix/network_spec.rb
index af944160..d1aa92c9 100644
--- a/spec/unit/plugins/aix/network_spec.rb
+++ b/spec/unit/plugins/aix/network_spec.rb
@@ -21,19 +21,19 @@ require "spec_helper"
describe Ohai::System, "AIX network plugin" do
before do
@netstat_rn = <<~NETSTAT_RN
- Destination Gateway Flags Refcnt Use Interface
- Destination Gateway Flags Refs Use If Exp Groups
- Only the root user can specify the Z flag
- (Internet):
- default 172.31.0.1 UG 2 1652046 en0 - - =>
- 127/8 127.0.0.1 U 5 2455591 lo0 - - =>
- 172.31.0.0 172.31.10.23 UHSb 0 0 en0 - - =>
- 172.31/20 172.31.10.23 U 1 1015674 en0 - - =>
- 172.31.10.23 127.0.0.1 UGHS 0 1 lo0 - -
- 172.31.15.255 172.31.10.23 UHSb 0 1 en0 - - =>
- Only the root user can specify the Z flag
- (Internet v6):
- ::1%1 ::1%1 UH 1 677032 lo0 - - =>
+ Destination Gateway Flags Refcnt Use Interface
+ Destination Gateway Flags Refs Use If Exp Groups
+ Only the root user can specify the Z flag
+ (Internet):
+ default 172.31.0.1 UG 2 1652046 en0 - - =>
+ 127/8 127.0.0.1 U 5 2455591 lo0 - - =>
+ 172.31.0.0 172.31.10.23 UHSb 0 0 en0 - - =>
+ 172.31/20 172.31.10.23 U 1 1015674 en0 - - =>
+ 172.31.10.23 127.0.0.1 UGHS 0 1 lo0 - -
+ 172.31.15.255 172.31.10.23 UHSb 0 1 en0 - - =>
+ Only the root user can specify the Z flag
+ (Internet v6):
+ ::1%1 ::1%1 UH 1 677032 lo0 - - =>
NETSTAT_RN
@ifconfig = <<~IFCONFIG
diff --git a/spec/unit/plugins/c_spec.rb b/spec/unit/plugins/c_spec.rb
index 319bc476..e295e0ca 100644
--- a/spec/unit/plugins/c_spec.rb
+++ b/spec/unit/plugins/c_spec.rb
@@ -1,4 +1,3 @@
-
# Author:: Doug MacEachern <dougm@vmware.com>
# Copyright:: Copyright (c) 2010 VMware, Inc.
# License:: Apache License, Version 2.0
diff --git a/spec/unit/plugins/chef_spec.rb b/spec/unit/plugins/chef_spec.rb
index 9199adc3..2584a278 100644
--- a/spec/unit/plugins/chef_spec.rb
+++ b/spec/unit/plugins/chef_spec.rb
@@ -33,7 +33,6 @@ begin
pending "would set [:chef_packages][:chef][:version] if chef was available", unless: defined?(Chef)
end
-
rescue LoadError
# the chef module is not available, ignoring.
diff --git a/spec/unit/plugins/docker_spec.rb b/spec/unit/plugins/docker_spec.rb
index c3105048..781b1f97 100644
--- a/spec/unit/plugins/docker_spec.rb
+++ b/spec/unit/plugins/docker_spec.rb
@@ -40,12 +40,13 @@ expected_output = {
"local",
],
"Network" => %w{
-bridge
-host
-ipvlan
-macvlan
-null
-overlay},
+ bridge
+ host
+ ipvlan
+ macvlan
+ null
+ overlay
+ },
"Authorization" => nil,
"Log" => %w{
awslogs
diff --git a/spec/unit/plugins/linux/network_spec.rb b/spec/unit/plugins/linux/network_spec.rb
index 978160bb..744fafa8 100644
--- a/spec/unit/plugins/linux/network_spec.rb
+++ b/spec/unit/plugins/linux/network_spec.rb
@@ -720,7 +720,7 @@ describe Ohai::System, "Linux Network Plugin" do
end
it "detects the ipv6 addresses of an ethernet subinterface" do
- %w{ 1111:2222:3333:4444::2 1111:2222:3333:4444::3 }.each do |addr|
+ %w{1111:2222:3333:4444::2 1111:2222:3333:4444::3}.each do |addr|
expect(plugin["network"]["interfaces"]["eth0.11"]["addresses"].keys).to include(addr)
expect(plugin["network"]["interfaces"]["eth0.11"]["addresses"][addr]["scope"]).to eq("Global")
expect(plugin["network"]["interfaces"]["eth0.11"]["addresses"][addr]["prefixlen"]).to eq("64")
diff --git a/spec/unit/plugins/linux/selinux_spec.rb b/spec/unit/plugins/linux/selinux_spec.rb
index 6f8ceef4..dd642b30 100644
--- a/spec/unit/plugins/linux/selinux_spec.rb
+++ b/spec/unit/plugins/linux/selinux_spec.rb
@@ -26,35 +26,35 @@ describe Ohai::System, "Linux selinux plugin" do
end
it "populates selinux if sestatus is found" do
- sestatus_out = <<-SESTATUS_OUT
-SELinux status: enabled
-SELinuxfs mount: /sys/fs/selinux
-SELinux root directory: /etc/selinux
-Loaded policy name: test
-Current mode: permissive
-Mode from config file: permissive
-Policy MLS status: disabled
-Policy deny_unknown status: allowed
-Max kernel policy version: 31
+ sestatus_out = <<~SESTATUS_OUT
+ SELinux status: enabled
+ SELinuxfs mount: /sys/fs/selinux
+ SELinux root directory: /etc/selinux
+ Loaded policy name: test
+ Current mode: permissive
+ Mode from config file: permissive
+ Policy MLS status: disabled
+ Policy deny_unknown status: allowed
+ Max kernel policy version: 31
-Policy booleans:
-secure_mode_policyload off
+ Policy booleans:
+ secure_mode_policyload off
-Process contexts:
-Current context: user_u:base_r:admin_t
-Init context: system_u:system_r:init_t
-/usr/sbin/sshd system_u:base_r:base_t
+ Process contexts:
+ Current context: user_u:base_r:admin_t
+ Init context: system_u:system_r:init_t
+ /usr/sbin/sshd system_u:base_r:base_t
-File contexts:
-Controlling terminal: system_u:object_r:file_t
-/etc/passwd user_u:object_r:file_t
-/etc/shadow user_u:object_r:file_t
-/bin/bash user_u:object_r:file_t
-/bin/login user_u:object_r:file_t
-/bin/sh user_u:object_r:file_t -> user_u:object_r:file_t
-/sbin/agetty user_u:object_r:file_t
-/sbin/init user_u:object_r:file_t -> user_u:object_r:init_exec_t
-/usr/sbin/sshd user_u:object_r:file_t
+ File contexts:
+ Controlling terminal: system_u:object_r:file_t
+ /etc/passwd user_u:object_r:file_t
+ /etc/shadow user_u:object_r:file_t
+ /bin/bash user_u:object_r:file_t
+ /bin/login user_u:object_r:file_t
+ /bin/sh user_u:object_r:file_t -> user_u:object_r:file_t
+ /sbin/agetty user_u:object_r:file_t
+ /sbin/init user_u:object_r:file_t -> user_u:object_r:init_exec_t
+ /usr/sbin/sshd user_u:object_r:file_t
SESTATUS_OUT
allow(plugin).to receive(:which).with("sestatus").and_return("/usr/sbin/sestatus")
allow(plugin).to receive(:shell_out).with("/usr/sbin/sestatus -v -b").and_return(mock_shell_out(0, sestatus_out, ""))
diff --git a/spec/unit/plugins/packages_spec.rb b/spec/unit/plugins/packages_spec.rb
index 0406aaac..cc658bff 100644
--- a/spec/unit/plugins/packages_spec.rb
+++ b/spec/unit/plugins/packages_spec.rb
@@ -190,10 +190,10 @@ describe Ohai::System, "plugin packages" do
"Publisher" => "nxsec.com",
"InstallDate" => "20150511",
},
- { "DisplayName" => "Chef Development Kit v0.7.0",
- "DisplayVersion" => "0.7.0.1",
- "Publisher" => "\"Chef Software, Inc. <maintainers@chef.io>\"",
- "InstallDate" => "20150925" }]
+ { "DisplayName" => "Chef Development Kit v0.7.0",
+ "DisplayVersion" => "0.7.0.1",
+ "Publisher" => "\"Chef Software, Inc. <maintainers@chef.io>\"",
+ "InstallDate" => "20150925" }]
end
shared_examples "windows_package_plugin" do
diff --git a/spec/unit/plugins/shard_spec.rb b/spec/unit/plugins/shard_spec.rb
index f0da5fb5..b0f3b154 100644
--- a/spec/unit/plugins/shard_spec.rb
+++ b/spec/unit/plugins/shard_spec.rb
@@ -119,7 +119,7 @@ describe Ohai::System, "shard plugin" do
let(:os) { "aix" }
it "provides a shard with a default-safe set of sources" do
- # Note: this is different than the other defaults.
+ # NOTE: this is different than the other defaults.
expect(subject).to eq(253499154)
end
end
diff --git a/spec/unit/plugins/solaris2/network_spec.rb b/spec/unit/plugins/solaris2/network_spec.rb
index 07151ce7..9bbf300c 100644
--- a/spec/unit/plugins/solaris2/network_spec.rb
+++ b/spec/unit/plugins/solaris2/network_spec.rb
@@ -177,7 +177,7 @@ describe Ohai::System, "Solaris2.X network plugin" do
end
it "finds the flags for a PHYSRUNNING interface" do
- expect(@plugin[:network][:interfaces]["net1:1"][:flags]).to eq(%w{ UP BROADCAST RUNNING MULTICAST IPv4 PHYSRUNNING })
+ expect(@plugin[:network][:interfaces]["net1:1"][:flags]).to eq(%w{UP BROADCAST RUNNING MULTICAST IPv4 PHYSRUNNING})
end
it "finds the default interface for a solaris 11 zone" do