From: Tim Smith Date: Tue, 15 Sep 2015 22:18:18 +0000 (-0700) Subject: Resolve rubocop warnings X-Git-Tag: v0.9.2~1^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=45d79554ef816a85932d3d2c79f443ada23871af;p=ceph-cookbooks.git Resolve rubocop warnings --- diff --git a/attributes/cephfs.rb b/attributes/cephfs.rb index 7c63117..0ca75f8 100644 --- a/attributes/cephfs.rb +++ b/attributes/cephfs.rb @@ -1,5 +1,5 @@ default['ceph']['cephfs_mount'] = '/ceph' -default['ceph']['cephfs_use_fuse'] = nil # whether the recipe's fuse mount uses cephfs-fuse instead of kernel client, defaults to heuristics +default['ceph']['cephfs_use_fuse'] = nil # whether the recipe's fuse mount uses cephfs-fuse instead of kernel client, defaults to heuristics case node['platform_family'] when 'debian' diff --git a/libraries/default.rb b/libraries/default.rb index 44a47e1..297da37 100644 --- a/libraries/default.rb +++ b/libraries/default.rb @@ -19,7 +19,6 @@ def mon_env_search_string elsif node['ceph']['search_environment'] # search for any nodes with this environment search_string += " AND chef_environment:#{node.chef_environment}" - else # search for any mon nodes end end @@ -121,7 +120,7 @@ def mon_addresses end end end - mon_ips.reject { |m| m.nil? }.uniq + mon_ips.reject(&:nil?).uniq end def mon_secret diff --git a/providers/client.rb b/providers/client.rb index 8731221..548b76b 100644 --- a/providers/client.rb +++ b/providers/client.rb @@ -14,17 +14,17 @@ action :add do if @current_resource.exists if @current_resource.keys_match && @current_resource.caps_match - Chef::Log.info "Client #{ @new_resource } already exists and matches "\ + Chef::Log.info "Client #{@new_resource} already exists and matches "\ 'specifications - nothing to do.' else - converge_by("Recreating client #{ @new_resource } as existing doesn't "\ + converge_by("Recreating client #{@new_resource} as existing doesn't "\ 'match specifications') do delete_entity(keyname) create_entity(keyname) end end else - converge_by("Creating client #{ @new_resource }") do + converge_by("Creating client #{@new_resource}") do create_entity(keyname) end end @@ -40,7 +40,6 @@ action :add do mode mode sensitive true if Chef::Resource::File.method_defined? :sensitive end - end def load_current_resource diff --git a/providers/pool.rb b/providers/pool.rb index 2c2b0b0..182c450 100644 --- a/providers/pool.rb +++ b/providers/pool.rb @@ -13,9 +13,9 @@ use_inline_resources action :create do if @current_resource.exists - Chef::Log.info "#{ @new_resource } already exists - nothing to do." + Chef::Log.info "#{@new_resource} already exists - nothing to do." else - converge_by("Creating #{ @new_resource }") do + converge_by("Creating #{@new_resource}") do create_pool end end @@ -23,11 +23,11 @@ end action :delete do if @current_resource.exists - converge_by("Deleting #{ @new_resource }") do + converge_by("Deleting #{@new_resource}") do delete_pool end else - Chef::Log.info "#{ @current_resource } does not exist - nothing to do." + Chef::Log.info "#{@current_resource} does not exist - nothing to do." end end @@ -43,7 +43,7 @@ def create_pool cmd = Mixlib::ShellOut.new(cmd_text) cmd.run_command cmd.error! - Chef::Log.debug "Pool created: #{ cmd.stderr }" + Chef::Log.debug "Pool created: #{cmd.stderr}" end def delete_pool @@ -53,16 +53,16 @@ def delete_pool cmd = Mixlib::ShellOut.new(cmd_text) cmd.run_command cmd.error! - Chef::Log.debug "Pool deleted: #{ cmd.stderr }" + Chef::Log.debug "Pool deleted: #{cmd.stderr}" end def pool_exists?(name) cmd = Mixlib::ShellOut.new("ceph osd pool get #{name} size") cmd.run_command cmd.error! - Chef::Log.debug "Pool exists: #{ cmd.stdout }" + Chef::Log.debug "Pool exists: #{cmd.stdout}" true rescue - Chef::Log.debug "Pool doesn't seem to exist: #{ cmd.stderr }" + Chef::Log.debug "Pool doesn't seem to exist: #{cmd.stderr}" false end diff --git a/recipes/osd.rb b/recipes/osd.rb index 8cf4100..d07f161 100644 --- a/recipes/osd.rb +++ b/recipes/osd.rb @@ -94,7 +94,7 @@ else if node['ceph']['osd_devices'] devices = node['ceph']['osd_devices'] - devices = Hash[(0...devices.size).zip devices] unless devices.kind_of? Hash + devices = Hash[(0...devices.size).zip devices] unless devices.is_a? Hash devices.each do |index, osd_device| unless osd_device['status'].nil? diff --git a/recipes/radosgw_apache2_repo.rb b/recipes/radosgw_apache2_repo.rb index e34b64d..e58182b 100644 --- a/recipes/radosgw_apache2_repo.rb +++ b/recipes/radosgw_apache2_repo.rb @@ -1,6 +1,6 @@ if node['ceph']['radosgw']['use_apache_fork'] == true if node.platform_family?('debian') && - %w(precise quantal raring saucy squeeze trusty wheezy).include?(node['lsb']['codename']) + %w(precise quantal raring saucy squeeze trusty wheezy).include?(node['lsb']['codename']) apt_repository 'ceph-apache2' do repo_name 'ceph-apache2' uri "http://gitbuilder.ceph.com/apache2-deb-#{node['lsb']['codename']}-x86_64-basic/ref/master" @@ -16,7 +16,7 @@ if node['ceph']['radosgw']['use_apache_fork'] == true key 'https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/autobuild.asc' end elsif (node.platform_family?('fedora') && [18, 19].include?(node['platform_version'].to_i)) || - (node.platform_family?('rhel') && [6].include?(node['platform_version'].to_i)) + (node.platform_family?('rhel') && [6].include?(node['platform_version'].to_i)) platform_family = node['platform_family'] platform_version = node['platform_version'].to_i yum_repository 'ceph-apache2' do