diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-18 08:42:27 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-18 10:11:56 -0800 |
commit | 1a882ccad96fdfc5de234c9c72c35bef1a6baba1 (patch) | |
tree | ee83ac4550148822e76395e972a5c9dac6a04d86 | |
parent | 933594b5cf17f4e6bcc02d5280a653319c35f44e (diff) | |
download | ohai-1a882ccad96fdfc5de234c9c72c35bef1a6baba1.tar.gz |
autofixing chefstyle cops
-rw-r--r-- | lib/ohai/mixin/command.rb | 4 | ||||
-rw-r--r-- | lib/ohai/plugins/aix/virtualization.rb | 6 | ||||
-rw-r--r-- | lib/ohai/plugins/darwin/network.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/linux/virtualization.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/network.rb | 6 | ||||
-rw-r--r-- | lib/ohai/plugins/network_listeners.rb | 4 | ||||
-rw-r--r-- | lib/ohai/plugins/sigar/network.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/sigar/network_route.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/solaris2/cpu.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/solaris2/dmi.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/windows/network.rb | 2 | ||||
-rw-r--r-- | lib/ohai/system.rb | 2 | ||||
-rw-r--r-- | spec/unit/plugins/darwin/kernel_spec.rb | 6 | ||||
-rw-r--r-- | spec/unit/plugins/dmi_spec.rb | 6 | ||||
-rw-r--r-- | spec/unit/plugins/solaris2/kernel_spec.rb | 2 |
15 files changed, 25 insertions, 25 deletions
diff --git a/lib/ohai/mixin/command.rb b/lib/ohai/mixin/command.rb index b76fa3ef..69c1c095 100644 --- a/lib/ohai/mixin/command.rb +++ b/lib/ohai/mixin/command.rb @@ -37,7 +37,7 @@ module Ohai module_function :shell_out def run_command(args = {}) - Ohai::Log.warn('Ohai::Mixin::Command run_command is deprecated and will be removed in Ohai 9.0.0') + Ohai::Log.warn("Ohai::Mixin::Command run_command is deprecated and will be removed in Ohai 9.0.0") if args.has_key?(:creates) if File.exists?(args[:creates]) Ohai::Log.debug("Skipping #{args[:command]} - creates #{args[:creates]} exists.") @@ -125,7 +125,7 @@ module Ohai # # Thanks Ara! def popen4(cmd, args = {}, &b) - Ohai::Log.warn('Ohai::Mixin::Command popen4 is deprecated and will be removed in Ohai 9.0.0') + Ohai::Log.warn("Ohai::Mixin::Command popen4 is deprecated and will be removed in Ohai 9.0.0") # Disable garbage collection to work around possible bug in MRI # Ruby 1.8 suffers from intermittent segfaults believed to be due to GC while IO.select diff --git a/lib/ohai/plugins/aix/virtualization.rb b/lib/ohai/plugins/aix/virtualization.rb index fdce73ef..9271323a 100644 --- a/lib/ohai/plugins/aix/virtualization.rb +++ b/lib/ohai/plugins/aix/virtualization.rb @@ -82,8 +82,8 @@ Ohai.plugin(:Virtualization) do value = { "mountpoint" => splat[0], "device" => splat[1], - "vfs" => splat[2], - "options" => splat[3].split(","), + "vfs" => splat[2], + "options" => splat[3].split(","), } wpars[wpar_name][title][key] = value when "security settings" @@ -103,7 +103,7 @@ Ohai.plugin(:Virtualization) do key = splat[0].downcase value = { "type" => splat[1], - "status" => splat[2], + "status" => splat[2], } wpars[wpar_name][title][key] = value else diff --git a/lib/ohai/plugins/darwin/network.rb b/lib/ohai/plugins/darwin/network.rb index 52febfce..164ecbb6 100644 --- a/lib/ohai/plugins/darwin/network.rb +++ b/lib/ohai/plugins/darwin/network.rb @@ -185,7 +185,7 @@ Ohai.plugin(:Network) do so = shell_out("netstat -i -d -l -b -n") so.stdout.lines do |line| if line =~ /^([a-zA-Z0-9\.\:\-\*]+)\s+\d+\s+\<[a-zA-Z0-9\#]+\>\s+([a-f0-9\:]+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/ || - line =~ /^([a-zA-Z0-9\.\:\-\*]+)\s+\d+\s+\<[a-zA-Z0-9\#]+\>(\s+)(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/ + line =~ /^([a-zA-Z0-9\.\:\-\*]+)\s+\d+\s+\<[a-zA-Z0-9\#]+\>(\s+)(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/ ifname = locate_interface(iface, $1, $2) next if iface[ifname].nil? # this shouldn't happen, but just in case net_counters[ifname] = Mash.new unless net_counters[ifname] diff --git a/lib/ohai/plugins/linux/virtualization.rb b/lib/ohai/plugins/linux/virtualization.rb index d681bc5d..ae559b58 100644 --- a/lib/ohai/plugins/linux/virtualization.rb +++ b/lib/ohai/plugins/linux/virtualization.rb @@ -163,7 +163,7 @@ Ohai.plugin(:Virtualization) do if File.exist?("/proc/self/cgroup") cgroup_content = File.read("/proc/self/cgroup") if cgroup_content =~ %r{^\d+:[^:]+:/(lxc|docker)/.+$} || - cgroup_content =~ %r{^\d+:[^:]+:/[^/]+/(lxc|docker)-.+$} + cgroup_content =~ %r{^\d+:[^:]+:/[^/]+/(lxc|docker)-.+$} virtualization[:system] = $1 virtualization[:role] = "guest" virtualization[:systems][$1.to_sym] = "guest" diff --git a/lib/ohai/plugins/network.rb b/lib/ohai/plugins/network.rb index caa3e840..e33b2d9d 100644 --- a/lib/ohai/plugins/network.rb +++ b/lib/ohai/plugins/network.rb @@ -79,8 +79,8 @@ Ohai.plugin(:NetworkAddresses) do if gw_if_ips.empty? Ohai::Log.warn("[#{family}] no ip address on #{network[int_attr]}") elsif network[gw_attr] && - network["interfaces"][network[int_attr]] && - network["interfaces"][network[int_attr]]["addresses"] + network["interfaces"][network[int_attr]] && + network["interfaces"][network[int_attr]]["addresses"] if [ "0.0.0.0", "::", /^fe80:/ ].any? { |pat| pat === network[gw_attr] } # link level default route Ohai::Log.debug("link level default #{family} route, picking ip from #{network[gw_attr]}") @@ -176,7 +176,7 @@ Ohai.plugin(:NetworkAddresses) do end if results["inet"]["iface"] && results["inet6"]["iface"] && - (results["inet"]["iface"] != results["inet6"]["iface"]) + (results["inet"]["iface"] != results["inet6"]["iface"]) Ohai::Log.debug("ipaddress and ip6address are set from different interfaces (#{results["inet"]["iface"]} & #{results["inet6"]["iface"]})") end end diff --git a/lib/ohai/plugins/network_listeners.rb b/lib/ohai/plugins/network_listeners.rb index 62661c77..292378d7 100644 --- a/lib/ohai/plugins/network_listeners.rb +++ b/lib/ohai/plugins/network_listeners.rb @@ -23,7 +23,7 @@ Ohai.plugin(:NetworkListeners) do collect_data do begin - require 'sigar' + require "sigar" flags = Sigar::NETCONN_TCP | Sigar::NETCONN_SERVER network Mash.new unless network @@ -54,7 +54,7 @@ Ohai.plugin(:NetworkListeners) do network[:listeners] = Mash.new network[:listeners][:tcp] = listeners rescue LoadError - Ohai::Log.debug('Could not load sigar gem. Skipping NetworkListeners plugin') + Ohai::Log.debug("Could not load sigar gem. Skipping NetworkListeners plugin") end end end diff --git a/lib/ohai/plugins/sigar/network.rb b/lib/ohai/plugins/sigar/network.rb index d5bfa52d..b5645060 100644 --- a/lib/ohai/plugins/sigar/network.rb +++ b/lib/ohai/plugins/sigar/network.rb @@ -58,7 +58,7 @@ Ohai.plugin(:Network) do iface[cint][:addresses][ifconfig.address] = { "family" => "inet" } # Backwards compat: no broadcast on tunnel or loopback dev if ((ifconfig.flags & Sigar::IFF_POINTOPOINT) == 0) && - ((ifconfig.flags & Sigar::IFF_LOOPBACK) == 0) + ((ifconfig.flags & Sigar::IFF_LOOPBACK) == 0) iface[cint][:addresses][ifconfig.address]["broadcast"] = ifconfig.broadcast end iface[cint][:addresses][ifconfig.address]["netmask"] = ifconfig.netmask diff --git a/lib/ohai/plugins/sigar/network_route.rb b/lib/ohai/plugins/sigar/network_route.rb index f4d3161f..4d191e9f 100644 --- a/lib/ohai/plugins/sigar/network_route.rb +++ b/lib/ohai/plugins/sigar/network_route.rb @@ -59,6 +59,6 @@ Ohai.plugin(:NetworkRoutes) do end end rescue LoadError - Ohai::Log.debug('Could not load sigar gem. Skipping NetworkRoutes plugin') + Ohai::Log.debug("Could not load sigar gem. Skipping NetworkRoutes plugin") end end diff --git a/lib/ohai/plugins/solaris2/cpu.rb b/lib/ohai/plugins/solaris2/cpu.rb index 4a60318e..52b8941e 100644 --- a/lib/ohai/plugins/solaris2/cpu.rb +++ b/lib/ohai/plugins/solaris2/cpu.rb @@ -33,7 +33,7 @@ Ohai.plugin(:CPU) do processor_info.each_with_index do |processor, i| desc, instance, record, keyvalue = processor.split(":") cpu[instance] ||= Mash.new - if (currentcpu != instance) + if currentcpu != instance cpu["total"] += 1 currentcpu = instance end diff --git a/lib/ohai/plugins/solaris2/dmi.rb b/lib/ohai/plugins/solaris2/dmi.rb index f4d8cc3c..96e57b15 100644 --- a/lib/ohai/plugins/solaris2/dmi.rb +++ b/lib/ohai/plugins/solaris2/dmi.rb @@ -117,7 +117,7 @@ Ohai.plugin(:DMI) do # remove/replace any characters that don't fall inside permissible ASCII range, or whitespace line = raw_line.gsub(/[^\x20-\x7E\n\t\r]/, ".") - if (line != raw_line) + if line != raw_line Ohai::Log.debug("converted characters from line:\n#{raw_line}") end diff --git a/lib/ohai/plugins/windows/network.rb b/lib/ohai/plugins/windows/network.rb index 65d76cd1..37f92fdc 100644 --- a/lib/ohai/plugins/windows/network.rb +++ b/lib/ohai/plugins/windows/network.rb @@ -96,7 +96,7 @@ Ohai.plugin(:Network) do # Apparently you can have more than one mac_address? Odd. [iface[cint][:configuration][:mac_address]].flatten.each do |mac_addr| iface[cint][:addresses][mac_addr] = { - "family" => "lladdr" + "family" => "lladdr" } end iface[cint][:mtu] = iface[cint][:configuration][:mtu] diff --git a/lib/ohai/system.rb b/lib/ohai/system.rb index c36ac7f6..4a09966c 100644 --- a/lib/ohai/system.rb +++ b/lib/ohai/system.rb @@ -212,7 +212,7 @@ module Ohai Ohai.config.merge!(@config) if Ohai.config[:directory] && - !Ohai.config[:plugin_path].include?(Ohai.config[:directory]) + !Ohai.config[:plugin_path].include?(Ohai.config[:directory]) Ohai.config[:plugin_path] << Ohai.config[:directory] end end diff --git a/spec/unit/plugins/darwin/kernel_spec.rb b/spec/unit/plugins/darwin/kernel_spec.rb index 092beba0..54cdb7b4 100644 --- a/spec/unit/plugins/darwin/kernel_spec.rb +++ b/spec/unit/plugins/darwin/kernel_spec.rb @@ -34,9 +34,9 @@ describe Ohai::System, "Darwin kernel plugin" do EOF modules = { - "com.apple.kec.corecrypto" => { "version" => "1.0", "size" => 266240, "index" => "8", "refcount" => "0" }, - "com.apple.iokit.IOACPIFamily" => { "version" => "1.4", "size" => 36864, "index" => "9", "refcount" => "22" }, - "com.apple.iokit.IOPCIFamily" => { "version" => "2.8", "size" => 167936, "index" => "10", "refcount" => "30" } } + "com.apple.kec.corecrypto" => { "version" => "1.0", "size" => 266240, "index" => "8", "refcount" => "0" }, + "com.apple.iokit.IOACPIFamily" => { "version" => "1.4", "size" => 36864, "index" => "9", "refcount" => "22" }, + "com.apple.iokit.IOPCIFamily" => { "version" => "2.8", "size" => 167936, "index" => "10", "refcount" => "30" } } @plugin.run expect(@plugin[:kernel][:modules]).to eql(modules) diff --git a/spec/unit/plugins/dmi_spec.rb b/spec/unit/plugins/dmi_spec.rb index a97c5ea6..6e8c0d41 100644 --- a/spec/unit/plugins/dmi_spec.rb +++ b/spec/unit/plugins/dmi_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -16,7 +16,7 @@ # limitations under the License. # -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') +require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb") # NOTE: These data lines must be prefixed with one or two tabs, not spaces. DMI_OUT = <<-EOS diff --git a/spec/unit/plugins/solaris2/kernel_spec.rb b/spec/unit/plugins/solaris2/kernel_spec.rb index ad6f9768..4cf82477 100644 --- a/spec/unit/plugins/solaris2/kernel_spec.rb +++ b/spec/unit/plugins/solaris2/kernel_spec.rb @@ -151,7 +151,7 @@ describe Ohai::System, "Solaris2.X kernel plugin" do # Teh daterz # Id Loadaddr Size Info Rev Module Name # 6 1180000 4623 1 1 specfs (filesystem for specfs) - teh_daterz = { "id" => 6, "loadaddr" => "1180000", "size" => 17955, "description" => "filesystem for specfs" } + teh_daterz = { "id" => 6, "loadaddr" => "1180000", "size" => 17955, "description" => "filesystem for specfs" } expect(@plugin[:kernel][:modules].keys).to include("specfs") expect(@plugin[:kernel][:modules].keys).not_to include("Module") expect(@plugin[:kernel][:modules]["specfs"]).to eq(teh_daterz) |