diff options
author | mcquin <claire@chef.io> | 2016-04-01 09:33:35 -0700 |
---|---|---|
committer | mcquin <claire@chef.io> | 2016-04-01 09:33:35 -0700 |
commit | 870a18f6733bbad941c2846b16d78e338d1c30f4 (patch) | |
tree | 7d407f8d421e4c6c9845d976ef2518654e054aca | |
parent | af291324a73ac44836cadafd96114a535b681b43 (diff) | |
download | ohai-chefstyle-0.3.1.tar.gz |
Update chefstyle to 0.3.1 and fix new offenses.chefstyle-0.3.1
39 files changed, 85 insertions, 85 deletions
@@ -5,7 +5,7 @@ gemspec group :development do gem "sigar", :platform => "ruby" - gem "chefstyle", "= 0.3.0" + gem "chefstyle", "= 0.3.1" # gem 'pry-byebug' # gem 'pry-stack_explorer' end diff --git a/lib/ohai/common/dmi.rb b/lib/ohai/common/dmi.rb index 6a483d3d..2b5e2ff4 100644 --- a/lib/ohai/common/dmi.rb +++ b/lib/ohai/common/dmi.rb @@ -77,7 +77,7 @@ module Ohai def id_lookup(id) begin id = id.to_i - if (id >= 128) and (id <= 255) + if (id >= 128) && (id <= 255) id = "oem_data_#{id}" elsif DMI::IdToDescription.has_key?(id) id = DMI::IdToDescription[id] diff --git a/lib/ohai/config.rb b/lib/ohai/config.rb index 1ce5723f..e617ecbb 100644 --- a/lib/ohai/config.rb +++ b/lib/ohai/config.rb @@ -105,7 +105,7 @@ module Ohai private def self.option_deprecated(option) - <<-EOM.chomp!.gsub("\n", " ") + <<-EOM.chomp!.tr("\n", " ") Ohai::Config[:#{option}] is set. Ohai::Config[:#{option}] is deprecated and will be removed in future releases of ohai. Use ohai.#{option} in your configuration file to configure :#{option} for ohai. @@ -113,7 +113,7 @@ EOM end def self.option_might_be_deprecated(option) - option_deprecated(option) + <<-EOM.chomp!.gsub("\n", " ") + option_deprecated(option) + <<-EOM.chomp!.tr("\n", " ") If your configuration file is used with other applications which configure :#{option}, and you have not configured Ohai::Config[:#{option}], you may disregard this warning. diff --git a/lib/ohai/dsl/plugin.rb b/lib/ohai/dsl/plugin.rb index 53b5211e..e51923f0 100644 --- a/lib/ohai/dsl/plugin.rb +++ b/lib/ohai/dsl/plugin.rb @@ -117,7 +117,7 @@ module Ohai def each(&block) @data.each do |key, value| - block.call(key, value) + yield(key, value) end end diff --git a/lib/ohai/loader.rb b/lib/ohai/loader.rb index f5c37607..160640ad 100644 --- a/lib/ohai/loader.rb +++ b/lib/ohai/loader.rb @@ -173,7 +173,7 @@ For more information visit here: docs.chef.io/ohai_custom.html") def load_v7_plugin_class(contents, plugin_path) plugin_class = eval(contents, TOPLEVEL_BINDING, plugin_path) - unless plugin_class.kind_of?(Class) and plugin_class < Ohai::DSL::Plugin + unless plugin_class.kind_of?(Class) && plugin_class < Ohai::DSL::Plugin raise Ohai::Exceptions::IllegalPluginDefinition, "Plugin file cannot contain any statements after the plugin definition" end plugin_class.sources << plugin_path diff --git a/lib/ohai/mixin/command.rb b/lib/ohai/mixin/command.rb index 69c1c095..6e090db3 100644 --- a/lib/ohai/mixin/command.rb +++ b/lib/ohai/mixin/command.rb @@ -70,7 +70,7 @@ module Ohai args[:returns] ||= 0 args[:no_status_check] ||= false - if status.exitstatus != args[:returns] and not args[:no_status_check] + if status.exitstatus != args[:returns] && (not args[:no_status_check]) raise Ohai::Exceptions::Exec, "#{args[:command_string]} returned #{status.exitstatus}, expected #{args[:returns]}" else Ohai::Log.debug("Ran #{args[:command_string]} (#{args[:command]}) returned #{status.exitstatus}") diff --git a/lib/ohai/mixin/ec2_metadata.rb b/lib/ohai/mixin/ec2_metadata.rb index 6464377f..eb4e4e6a 100644 --- a/lib/ohai/mixin/ec2_metadata.rb +++ b/lib/ohai/mixin/ec2_metadata.rb @@ -140,7 +140,7 @@ module Ohai else metadata_get(key, api_version) end - elsif not key.eql?(id) and not key.eql?("/") + elsif (not key.eql?(id)) && (not key.eql?("/")) name = key[0..-2] sym = metadata_key(name) if EC2_ARRAY_DIR.include?(name) diff --git a/lib/ohai/plugins/c.rb b/lib/ohai/plugins/c.rb index 8cea4d0c..4dd5b2e7 100644 --- a/lib/ohai/plugins/c.rb +++ b/lib/ohai/plugins/c.rb @@ -90,7 +90,7 @@ Ohai.plugin(:C) do #ibm xlc begin so = shell_out("xlc -qversion") - if so.exitstatus == 0 or (so.exitstatus >> 8) == 249 + if so.exitstatus == 0 || (so.exitstatus >> 8) == 249 description = so.stdout.split($/).first if description =~ /V(\d+\.\d+)/ c[:xlc] = Mash.new diff --git a/lib/ohai/plugins/darwin/memory.rb b/lib/ohai/plugins/darwin/memory.rb index ec1bae95..28214c87 100644 --- a/lib/ohai/plugins/darwin/memory.rb +++ b/lib/ohai/plugins/darwin/memory.rb @@ -30,7 +30,7 @@ Ohai.plugin(:Memory) do inactive = 0 vm_stat = shell_out("vm_stat").stdout vm_stat_match = /page size of (\d+) bytes/.match(vm_stat) - page_size = if vm_stat_match and vm_stat_match[1] + page_size = if vm_stat_match && vm_stat_match[1] vm_stat_match[1].to_i else 4096 diff --git a/lib/ohai/plugins/darwin/network.rb b/lib/ohai/plugins/darwin/network.rb index 164ecbb6..780b1da7 100644 --- a/lib/ohai/plugins/darwin/network.rb +++ b/lib/ohai/plugins/darwin/network.rb @@ -61,8 +61,8 @@ Ohai.plugin(:Network) do def scope_lookup(scope) return "Node" if scope.eql?("::1") - return "Link" if scope.match(/^fe80\:/) - return "Site" if scope.match(/^fec0\:/) + return "Link" if scope =~ /^fe80\:/ + return "Site" if scope =~ /^fec0\:/ "Global" end @@ -73,7 +73,7 @@ Ohai.plugin(:Network) do def locate_interface(ifaces, ifname, mac) return ifname unless ifaces[ifname].nil? # oh well, time to go hunting! - return ifname.chop if ifname.match /\*$/ + return ifname.chop if ifname =~ /\*$/ ifaces.keys.each do |ifc| ifaces[ifc][:addresses].keys.each do |addr| return ifc if addr.eql? mac diff --git a/lib/ohai/plugins/darwin/platform.rb b/lib/ohai/plugins/darwin/platform.rb index 1277f8e8..0281663c 100644 --- a/lib/ohai/plugins/darwin/platform.rb +++ b/lib/ohai/plugins/darwin/platform.rb @@ -26,7 +26,7 @@ Ohai.plugin(:Platform) do when /^ProductName:\s+(.+)$/ macname = $1 macname.downcase! - macname.gsub!(" ", "_") + macname.tr!(" ", "_") platform macname when /^ProductVersion:\s+(.+)$/ platform_version $1 diff --git a/lib/ohai/plugins/darwin/system_profiler.rb b/lib/ohai/plugins/darwin/system_profiler.rb index ad67320e..20798cc4 100644 --- a/lib/ohai/plugins/darwin/system_profiler.rb +++ b/lib/ohai/plugins/darwin/system_profiler.rb @@ -53,7 +53,7 @@ SPUSBData SPWWANData SPAirPortData}, "full" => [ - "SPHardwareDataType" + "SPHardwareDataType", ], } diff --git a/lib/ohai/plugins/digital_ocean.rb b/lib/ohai/plugins/digital_ocean.rb index a72127b6..3b422df0 100644 --- a/lib/ohai/plugins/digital_ocean.rb +++ b/lib/ohai/plugins/digital_ocean.rb @@ -43,7 +43,7 @@ Ohai.plugin(:DigitalOcean) do address_hash = Mash.new({ "ip_address" => ip.address, "type" => private_address?(ip.address) ? "private" : "public", - },) + }) if ip.ipv4? address_hash["netmask"] = details[:netmask] diff --git a/lib/ohai/plugins/erlang.rb b/lib/ohai/plugins/erlang.rb index f9356fd3..fc947bee 100644 --- a/lib/ohai/plugins/erlang.rb +++ b/lib/ohai/plugins/erlang.rb @@ -34,7 +34,7 @@ Ohai.plugin(:Erlang) do erlang[:version] = output[5] erlang[:options] = options.split(",") erlang[:emulator] = output[2].gsub!(/(\(|\))/, "") - if erlang[:version] and erlang[:options] and erlang[:emulator] + if erlang[:version] && erlang[:options] && erlang[:emulator] languages[:erlang] = erlang end end diff --git a/lib/ohai/plugins/ip_scopes.rb b/lib/ohai/plugins/ip_scopes.rb index b74ab2f7..0785fbc6 100644 --- a/lib/ohai/plugins/ip_scopes.rb +++ b/lib/ohai/plugins/ip_scopes.rb @@ -30,7 +30,7 @@ Ohai.plugin(:IpScopes) do interface = network["interfaces"][ifName] interface["addresses"].each do |address, attrs| begin - attrs.merge! "ip_scope" => address.to_ip.scope + attrs["ip_scope"] = address.to_ip.scope if private_addr?(address) && !tunnel_iface?(interface) privateaddress(address) diff --git a/lib/ohai/plugins/kernel.rb b/lib/ohai/plugins/kernel.rb index 59665bba..b4c73b48 100644 --- a/lib/ohai/plugins/kernel.rb +++ b/lib/ohai/plugins/kernel.rb @@ -191,7 +191,7 @@ Ohai.plugin(:Kernel) do host = wmi.first_of("Win32_ComputerSystem") kernel[:cs_info] = Mash.new cs_info_blacklist = [ - "oem_logo_bitmap" + "oem_logo_bitmap", ] host.wmi_ole_object.properties_.each do |p| if !cs_info_blacklist.include?(p.name.wmi_underscore) diff --git a/lib/ohai/plugins/linux/network.rb b/lib/ohai/plugins/linux/network.rb index b46448ef..18f6dd31 100644 --- a/lib/ohai/plugins/linux/network.rb +++ b/lib/ohai/plugins/linux/network.rb @@ -205,7 +205,7 @@ Ohai.plugin(:Network) do net_counters[tmp_int][:tx][:queuelen] = $1 end - if line =~ /vlan id (\d+)/ or line =~ /vlan protocol ([\w\.]+) id (\d+)/ + if line =~ /vlan id (\d+)/ || line =~ /vlan protocol ([\w\.]+) id (\d+)/ if $2 tmp_prot = $1 tmp_id = $2 @@ -463,7 +463,7 @@ Ohai.plugin(:Network) do default_route = choose_default_route(routes) - if default_route.nil? or default_route.empty? + if default_route.nil? || default_route.empty? attribute_name = if family[:name] == "inet" "default_interface" else diff --git a/lib/ohai/plugins/mono.rb b/lib/ohai/plugins/mono.rb index 9254924b..f5bb8bcd 100644 --- a/lib/ohai/plugins/mono.rb +++ b/lib/ohai/plugins/mono.rb @@ -33,7 +33,7 @@ Ohai.plugin(:Mono) do mono[:version] = output[4] end if output.length >= 11 - mono[:builddate] = "%s %s %s %s" % [output[6], output[7], output[8], output[11].gsub!(/\)/, "")] + mono[:builddate] = "%s %s %s %s" % [output[6], output[7], output[8], output[11].delete!(")")] end languages[:mono] = mono if mono[:version] end diff --git a/lib/ohai/plugins/network.rb b/lib/ohai/plugins/network.rb index e33b2d9d..1a1175f5 100644 --- a/lib/ohai/plugins/network.rb +++ b/lib/ohai/plugins/network.rb @@ -39,7 +39,7 @@ Ohai.plugin(:NetworkAddresses) do Mash[network["interfaces"]].each do |iface, iface_v| next if iface_v.nil? || !iface_v.has_key?("addresses") iface_v["addresses"].each do |addr, addr_v| - next if addr_v.nil? or not addr_v.has_key? "family" or addr_v["family"] != family + next if addr_v.nil? || (not addr_v.has_key? "family") || addr_v["family"] != family ipaddresses << { :ipaddress => addr_v["prefixlen"] ? IPAddress("#{addr}/#{addr_v["prefixlen"]}") : IPAddress("#{addr}/#{addr_v["netmask"]}"), :scope => addr_v["scope"].nil? ? nil : addr_v["scope"].downcase, @@ -106,7 +106,7 @@ Ohai.plugin(:NetworkAddresses) do Ohai::Log.debug("[#{family}] no default interface, picking the first ipaddress") end - return [ nil, nil ] if r.nil? or r.empty? + return [ nil, nil ] if r.nil? || r.empty? [ r[:ipaddress].to_s, r[:iface] ] end diff --git a/lib/ohai/plugins/packages.rb b/lib/ohai/plugins/packages.rb index 334db7ce..97d29bac 100644 --- a/lib/ohai/plugins/packages.rb +++ b/lib/ohai/plugins/packages.rb @@ -25,7 +25,7 @@ Ohai.plugin(:Packages) do WINDOWS_ATTRIBUTE_ALIASES = { "DisplayVersion" => "version", "Publisher" => "publisher", - "InstallDate" => "installdate" + "InstallDate" => "installdate", } collect_data(:linux) do diff --git a/lib/ohai/plugins/python.rb b/lib/ohai/plugins/python.rb index e493421c..2e484a1c 100644 --- a/lib/ohai/plugins/python.rb +++ b/lib/ohai/plugins/python.rb @@ -32,10 +32,10 @@ Ohai.plugin(:Python) do output = so.stdout.split python[:version] = output[0] if output.length >= 6 - python[:builddate] = "%s %s %s %s" % [output[2], output[3], output[4], output[5].gsub!(/\)/, "")] + python[:builddate] = "%s %s %s %s" % [output[2], output[3], output[4], output[5].delete!(")")] end - languages[:python] = python if python[:version] and python[:builddate] + languages[:python] = python if python[:version] && python[:builddate] end end end diff --git a/lib/ohai/plugins/sigar/network.rb b/lib/ohai/plugins/sigar/network.rb index b5645060..68ce3add 100644 --- a/lib/ohai/plugins/sigar/network.rb +++ b/lib/ohai/plugins/sigar/network.rb @@ -156,7 +156,7 @@ Ohai.plugin(:Network) do network[:interfaces][route.ifname][:route] = Mash.new unless network[:interfaces][route.ifname][:route] route_data = {} Ohai::Mixin::NetworkConstants::SIGAR_ROUTE_METHODS.each do |m| - if(m == :flags) + if m == :flags route_data[m] = flags(route.send(m)) else route_data[m] = route.send(m) diff --git a/lib/ohai/plugins/sigar/network_route.rb b/lib/ohai/plugins/sigar/network_route.rb index 4d191e9f..d41c1524 100644 --- a/lib/ohai/plugins/sigar/network_route.rb +++ b/lib/ohai/plugins/sigar/network_route.rb @@ -49,7 +49,7 @@ Ohai.plugin(:NetworkRoutes) do network[:interfaces][route.ifname][:route] = Mash.new unless network[:interfaces][route.ifname][:route] route_data = {} Ohai::Mixin::NetworkConstants::SIGAR_ROUTE_METHODS.each do |m| - if(m == :flags) + if m == :flags route_data[m] = flags(route.send(m)) else route_data[m] = route.send(m) diff --git a/lib/ohai/plugins/solaris2/dmi.rb b/lib/ohai/plugins/solaris2/dmi.rb index 96e57b15..93423830 100644 --- a/lib/ohai/plugins/solaris2/dmi.rb +++ b/lib/ohai/plugins/solaris2/dmi.rb @@ -24,7 +24,7 @@ Ohai.plugin(:DMI) do # if we already have a "dmi" with keys (presumably from dmidecode), don't try smbios # note that a single key just means dmidecode exited with its version - if (dmi.class.to_s == "Mash") and (dmi.keys.length > 1) + if (dmi.class.to_s == "Mash") && (dmi.keys.length > 1) Ohai::Log.debug("skipping smbios output, since DMI information has already been provided") return end diff --git a/lib/ohai/plugins/ssh_host_key.rb b/lib/ohai/plugins/ssh_host_key.rb index 0491f855..323ddc14 100644 --- a/lib/ohai/plugins/ssh_host_key.rb +++ b/lib/ohai/plugins/ssh_host_key.rb @@ -51,7 +51,7 @@ Ohai.plugin(:SSHHostKey) do if sshd_config File.open(sshd_config) do |conf| conf.each_line do |line| - if line.match(/^hostkey\s/i) + if line =~ /^hostkey\s/i pub_file = "#{line.split[1]}.pub" content = IO.read(pub_file).split key_type, key_subtype = extract_keytype?(content) diff --git a/lib/ohai/plugins/windows/network.rb b/lib/ohai/plugins/windows/network.rb index 37f92fdc..79495378 100644 --- a/lib/ohai/plugins/windows/network.rb +++ b/lib/ohai/plugins/windows/network.rb @@ -64,7 +64,7 @@ Ohai.plugin(:Network) do end iface_instance.keys.each do |i| - if iface_config[i][:ip_enabled] and iface_instance[i][:net_connection_id] + if iface_config[i][:ip_enabled] && iface_instance[i][:net_connection_id] cint = sprintf("0x%x", iface_instance[i][:interface_index] ? iface_instance[i][:interface_index] : iface_instance[i][:index] ).downcase iface[cint] = Mash.new iface[cint][:configuration] = iface_config[i] @@ -76,7 +76,7 @@ Ohai.plugin(:Network) do ip = iface[cint][:configuration][:ip_address][i] _ip = IPAddress("#{ip}/#{iface[cint][:configuration][:ip_subnet][i]}") iface[cint][:addresses][ip] = Mash.new( - :prefixlen => _ip.prefix, + :prefixlen => _ip.prefix ) if _ip.ipv6? # inet6 address @@ -96,14 +96,14 @@ 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] iface[cint][:type] = iface[cint][:instance][:adapter_type] iface[cint][:arp] = {} iface[cint][:encapsulation] = windows_encaps_lookup(iface[cint][:instance][:adapter_type]) - if iface[cint][:configuration][:default_ip_gateway] != nil and iface[cint][:configuration][:default_ip_gateway].size > 0 + if iface[cint][:configuration][:default_ip_gateway] != nil && iface[cint][:configuration][:default_ip_gateway].size > 0 network[:default_gateway] = iface[cint][:configuration][:default_ip_gateway].first network[:default_interface] = cint end @@ -119,7 +119,7 @@ Ohai.plugin(:Network) do end next unless iface[cint] if line =~ /^\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+([a-fA-F0-9\:-]+)/ - iface[cint][:arp][$1] = $2.gsub("-", ":").downcase + iface[cint][:arp][$1] = $2.tr("-", ":").downcase end end end diff --git a/lib/ohai/provides_map.rb b/lib/ohai/provides_map.rb index da7d8be1..f9ba0518 100644 --- a/lib/ohai/provides_map.rb +++ b/lib/ohai/provides_map.rb @@ -114,8 +114,8 @@ module Ohai private def normalize_and_validate(attribute) - raise Ohai::Exceptions::AttributeSyntaxError, "Attribute contains duplicate '/' characters: #{attribute}" if attribute.match(/\/\/+/) - raise Ohai::Exceptions::AttributeSyntaxError, "Attribute contains a trailing '/': #{attribute}" if attribute.match(/\/$/) + raise Ohai::Exceptions::AttributeSyntaxError, "Attribute contains duplicate '/' characters: #{attribute}" if attribute =~ /\/\/+/ + raise Ohai::Exceptions::AttributeSyntaxError, "Attribute contains a trailing '/': #{attribute}" if attribute =~ /\/$/ parts = attribute.split("/") parts.shift if parts.length != 0 && parts[0].length == 0 # attribute begins with a '/' diff --git a/lib/ohai/system.rb b/lib/ohai/system.rb index 4a09966c..c9fe2e98 100644 --- a/lib/ohai/system.rb +++ b/lib/ohai/system.rb @@ -88,7 +88,7 @@ module Ohai # Users who are migrating from ohai 6 may give one or more Ohai 6 plugin # names as the +attribute_filter+. In this case we return early because # the v7 plugin provides map will not have an entry for this plugin. - if attribute_filter and Array(attribute_filter).all? { |filter_item| have_v6_plugin?(filter_item) } + if attribute_filter && Array(attribute_filter).all? { |filter_item| have_v6_plugin?(filter_item) } return true end diff --git a/platform_simulation_specs/common/ohai_plugin_common.rb b/platform_simulation_specs/common/ohai_plugin_common.rb index 229272c7..3e5970c7 100644 --- a/platform_simulation_specs/common/ohai_plugin_common.rb +++ b/platform_simulation_specs/common/ohai_plugin_common.rb @@ -185,7 +185,7 @@ def subsumes?(source, test, path = [], &block) if source.is_a?( Hash ) && test.is_a?( Hash ) test.all? { |k, v| subsumes?( source[k], v, path.clone << k, &block ) } else - block.call( path, source, test ) if block + yield(path, source, test) if block source == test end end diff --git a/spec/functional/loader_spec.rb b/spec/functional/loader_spec.rb index 5053ad6f..def45b3e 100644 --- a/spec/functional/loader_spec.rb +++ b/spec/functional/loader_spec.rb @@ -23,7 +23,7 @@ RSpec.describe "Ohai::Loader" do describe "#load_all" do context "when the plugin path contains backslash characters", :windows_only do let(:plugin_directory) { Dir.mktmpdir("plugins") } - let(:plugin_path) { plugin_directory.gsub("/", "\\") } + let(:plugin_path) { plugin_directory.tr("/", "\\") } before(:each) do Ohai.config[:plugin_path] = plugin_path diff --git a/spec/unit/plugins/digital_ocean_spec.rb b/spec/unit/plugins/digital_ocean_spec.rb index a4fb8baa..a9b0c48e 100644 --- a/spec/unit/plugins/digital_ocean_spec.rb +++ b/spec/unit/plugins/digital_ocean_spec.rb @@ -43,15 +43,15 @@ describe Ohai::System, "plugin digital_ocean" do "eth0" => { "addresses" => { "00:D3:AD:B3:3F:00" => { - "family" => "lladdr" + "family" => "lladdr", }, "1.2.3.4" => { - "netmask" => "255.255.255.0" + "netmask" => "255.255.255.0", }, "2400:6180:0000:00d0:0000:0000:0009:7001" => {}, - } - } - } + }, + }, + }, } allow(File).to receive(:exist?).with(hint_path_nix).and_return(true) @@ -132,10 +132,10 @@ describe Ohai::System, "plugin digital_ocean" do @plugin[:network][:interfaces][:eth1] = { "addresses" => { "10.128.142.89" => { - "netmask" => "255.255.255.0" + "netmask" => "255.255.255.0", }, "fdf8:f53b:82e4:0000:0000:0000:0000:0053" => {}, - } + }, } @plugin.run diff --git a/spec/unit/plugins/dmi_spec.rb b/spec/unit/plugins/dmi_spec.rb index 6e8c0d41..08a0bf25 100644 --- a/spec/unit/plugins/dmi_spec.rb +++ b/spec/unit/plugins/dmi_spec.rb @@ -116,16 +116,16 @@ describe Ohai::System, "plugin dmi" do { :bios => { :vendor => "Phoenix Technologies LTD", - :release_date => "12/31/2009" + :release_date => "12/31/2009", }, :system => { :manufacturer => "VMware, Inc.", - :product_name => "VMware Virtual Platform" + :product_name => "VMware Virtual Platform", }, :chassis => { :lock => "Not Present", - :asset_tag => "No Asset Tag" - } + :asset_tag => "No Asset Tag", + }, }.each do |id, data| data.each do |attribute, value| it "should have [:dmi][:#{id}][:#{attribute}] set" do diff --git a/spec/unit/plugins/linode_spec.rb b/spec/unit/plugins/linode_spec.rb index d0e918a1..62a05967 100644 --- a/spec/unit/plugins/linode_spec.rb +++ b/spec/unit/plugins/linode_spec.rb @@ -38,11 +38,11 @@ describe Ohai::System, "plugin linode" do "family" => "inet6", }, "40:40:95:47:6E:ED" => { - "family" => "lladdr" + "family" => "lladdr", }, - } - } - } + }, + }, + }, } end @@ -103,9 +103,9 @@ describe Ohai::System, "plugin linode" do "family" => "inet6", }, "40:40:F5:AB:28:36" => { - "family" => "lladdr" + "family" => "lladdr", }, - } + }, } end diff --git a/spec/unit/plugins/linux/sessions_spec.rb b/spec/unit/plugins/linux/sessions_spec.rb index 32936670..89130142 100644 --- a/spec/unit/plugins/linux/sessions_spec.rb +++ b/spec/unit/plugins/linux/sessions_spec.rb @@ -60,7 +60,7 @@ LOGINCTL_OUT "uid" => "1000", "user" => "joe", "seat" => nil, - } + }, }, "by_user" => { "Debian-gdm" => [{ @@ -73,7 +73,7 @@ LOGINCTL_OUT "session" => "318", "uid" => "0", "user" => "root", - "seat" => nil + "seat" => nil, }, { "session" => "46", "uid" => "0", diff --git a/spec/unit/plugins/network_spec.rb b/spec/unit/plugins/network_spec.rb index 8e37b24f..60d4cac6 100644 --- a/spec/unit/plugins/network_spec.rb +++ b/spec/unit/plugins/network_spec.rb @@ -58,7 +58,7 @@ describe Ohai::System, "Network Plugin" do "flags" => %w{UP BROADCAST RUNNING SIMPLEX MULTICAST}, "addresses" => { "00:00:24:c9:5e:b8" => { - "family" => "lladdr" + "family" => "lladdr", }, "fe80::200:24ff:fec9:5eb8" => { "family" => "inet6", @@ -83,7 +83,7 @@ describe Ohai::System, "Network Plugin" do "flags" => %w{UP BROADCAST RUNNING PROMISC SIMPLEX MULTICAST}, "addresses" => { "00:00:24:c9:5e:b9" => { - "family" => "lladdr" + "family" => "lladdr", }, "fe80::200:24ff:fec9:5eb9" => { "family" => "inet6", @@ -99,7 +99,7 @@ describe Ohai::System, "Network Plugin" do "flags" => %w{UP BROADCAST RUNNING PROMISC SIMPLEX MULTICAST}, "addresses" => { "00:00:24:c9:5e:ba" => { - "family" => "lladdr" + "family" => "lladdr", }, "fe80::200:24ff:fec9:5eba" => { "family" => "inet6", @@ -115,7 +115,7 @@ describe Ohai::System, "Network Plugin" do "flags" => %w{UP BROADCAST RUNNING PROMISC SIMPLEX MULTICAST}, "addresses" => { "00:00:24:c9:5e:bb" => { - "family" => "lladdr" + "family" => "lladdr", }, "fe80::200:24ff:fec9:5ebb" => { "family" => "inet6", @@ -158,7 +158,7 @@ describe Ohai::System, "Network Plugin" do "flags" => %w{LEARNING DISCOVER AUTOEDGE AUTOPTP}, "addresses" => { "02:20:6f:d2:c4:00" => { - "family" => "lladdr" + "family" => "lladdr", }, "192.168.2.1" => { "family" => "inet", @@ -197,7 +197,7 @@ describe Ohai::System, "Network Plugin" do "zoneid" => "gif0", "prefixlen" => "64", "scopeid" => "0xa", - } + }, }, }, }, @@ -205,7 +205,7 @@ describe Ohai::System, "Network Plugin" do "default_interface" => "vr0", "default_inet6_gateway" => "2001:470:d:cb4::2", "default_inet6_interface" => "bridge0", - } + }, }, "linux" => { "network" => { @@ -241,7 +241,7 @@ describe Ohai::System, "Network Plugin" do "family" => "inet6", }, "00:16:3E:2F:36:79" => { - "family" => "lladdr" + "family" => "lladdr", }, "192.168.66.33" => { "scope" => "Global", @@ -271,7 +271,7 @@ describe Ohai::System, "Network Plugin" do "family" => "inet6", }, "00:16:3E:2F:36:80" => { - "family" => "lladdr" + "family" => "lladdr", }, "192.168.99.11" => { "scope" => "Global", @@ -295,7 +295,7 @@ describe Ohai::System, "Network Plugin" do "default_interface" => "eth0", "default_inet6_gateway" => "3ffe:1111:2222::", "default_inet6_interface" => "eth0", - } + }, }, "windows" => { "network" => { @@ -314,17 +314,17 @@ describe Ohai::System, "Network Plugin" do "scope" => "Link", }, "52:54:44:66:66:02" => { - "family" => "lladdr" + "family" => "lladdr", }, }, "mtu" => nil, "type" => "Ethernet 802.3", "encapsulation" => "Ethernet", - } + }, }, "default_gateway" => "172.19.0.1", "default_interface" => "0xb", - } + }, }, } @@ -936,13 +936,13 @@ describe Ohai::System, "Network Plugin" do @plugin["ip6address"] = "3ffe:8888:9999::1" @expected_results = { "freebsd" => { - "macaddress" => "02:20:6f:d2:c4:00" + "macaddress" => "02:20:6f:d2:c4:00", }, "linux" => { - "macaddress" => "00:16:3E:2F:36:79" + "macaddress" => "00:16:3E:2F:36:79", }, "windows" => { - "macaddress" => "52:54:44:66:66:02" + "macaddress" => "52:54:44:66:66:02", }, } end diff --git a/spec/unit/plugins/openstack_spec.rb b/spec/unit/plugins/openstack_spec.rb index 0024eb5a..9cb113c7 100644 --- a/spec/unit/plugins/openstack_spec.rb +++ b/spec/unit/plugins/openstack_spec.rb @@ -171,7 +171,7 @@ EOM expect_get_response( URI.parse("#{openstack_metadata_endpoint}#{openstack_metadata_version}/meta_data.json"), - openstack_metadata_values, + openstack_metadata_values ) openstack_plugin.run diff --git a/spec/unit/plugins/packages_spec.rb b/spec/unit/plugins/packages_spec.rb index 332b89e8..62f3117e 100644 --- a/spec/unit/plugins/packages_spec.rb +++ b/spec/unit/plugins/packages_spec.rb @@ -112,7 +112,7 @@ describe Ohai::System, "plugin packages" do [{ "DisplayName" => "NXLOG-CE", "DisplayVersion" => "2.8.1248", "Publisher" => "nxsec.com", - "InstallDate" => "20150511" + "InstallDate" => "20150511", }, { "DisplayName" => "Chef Development Kit v0.7.0", "DisplayVersion" => "0.7.0.1", diff --git a/spec/unit/plugins/rackspace_spec.rb b/spec/unit/plugins/rackspace_spec.rb index 370abe5c..8fb42167 100644 --- a/spec/unit/plugins/rackspace_spec.rb +++ b/spec/unit/plugins/rackspace_spec.rb @@ -41,10 +41,10 @@ describe Ohai::System, "plugin rackspace" do "family" => "inet6", }, "40:40:95:47:6E:ED" => { - "family" => "lladdr" + "family" => "lladdr", }, - } } - } + } }, + }, } @plugin[:network][:interfaces][:eth1] = { :addresses => { @@ -59,7 +59,7 @@ describe Ohai::System, "plugin rackspace" do "family" => "inet", }, "40:40:F5:AB:28:36" => { - "family" => "lladdr" + "family" => "lladdr", }, } } @@ -260,7 +260,7 @@ OUT "family" => "inet", }, "BC:76:4E:20:42:2B" => { - "family" => "lladdr" + "family" => "lladdr", }, } } stdout = 'BC764E20422B = "{"label": "private-network"}"\n' diff --git a/spec/unit/plugins/solaris2/filesystem.rb b/spec/unit/plugins/solaris2/filesystem.rb index 1ed36cf7..97a3b222 100644 --- a/spec/unit/plugins/solaris2/filesystem.rb +++ b/spec/unit/plugins/solaris2/filesystem.rb @@ -53,8 +53,8 @@ describe Ohai::System, "Solaris2.X filesystem plugin" do let(:plugin_config) do { :filesystem => { - :zfs_properties => zfs_properties - } + :zfs_properties => zfs_properties, + }, } end |