Skip to content

Commit

Permalink
autofixing chefstyle cops
Browse files Browse the repository at this point in the history
  • Loading branch information
lamont-granquist committed Feb 18, 2016
1 parent cd11b92 commit afa2500
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions lib/ohai/mixin/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def shell_out(cmd)
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.")
Expand Down Expand Up @@ -125,7 +125,7 @@ def run_command_windows(command, timeout)
#
# 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
Expand Down
6 changes: 3 additions & 3 deletions lib/ohai/plugins/aix/virtualization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
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"
Expand All @@ -103,7 +103,7 @@
key = splat[0].downcase
value = {
"type" => splat[1],
"status" => splat[2],
"status" => splat[2],
}
wpars[wpar_name][title][key] = value
else
Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/darwin/network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def locate_interface(ifaces, ifname, mac)
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]
Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/linux/virtualization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def docker_exists?
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"
Expand Down
6 changes: 3 additions & 3 deletions lib/ohai/plugins/network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def find_ip(family = "inet")
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]}")
Expand Down Expand Up @@ -176,7 +176,7 @@ def network_contains_address(address_to_match, ipaddress, iface)
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
Expand Down
4 changes: 2 additions & 2 deletions lib/ohai/plugins/network_listeners.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

collect_data do
begin
require 'sigar'
require "sigar"
flags = Sigar::NETCONN_TCP | Sigar::NETCONN_SERVER

network Mash.new unless network
Expand Down Expand Up @@ -54,7 +54,7 @@
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
2 changes: 1 addition & 1 deletion lib/ohai/plugins/sigar/network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def fetch_interfaces(sigar)
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
Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/sigar/network_route.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ def flags(flags)
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
2 changes: 1 addition & 1 deletion lib/ohai/plugins/solaris2/cpu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
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
Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/solaris2/dmi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@

# 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

Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/windows/network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def windows_encaps_lookup(encap)
# 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]
Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def configure_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
Expand Down
6 changes: 3 additions & 3 deletions spec/unit/plugins/darwin/kernel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
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)
Expand Down
6 changes: 3 additions & 3 deletions spec/unit/plugins/dmi_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
# 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.
# See the License for the specific language governing permissions and
# 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
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/plugins/solaris2/kernel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
# 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)
Expand Down

0 comments on commit afa2500

Please sign in to comment.