diff --git a/Rakefile b/Rakefile index fa678eeb..d4e3695a 100644 --- a/Rakefile +++ b/Rakefile @@ -21,7 +21,7 @@ namespace :style do FoodCritic::Rake::LintTask.new(:chef) do |t| t.options = { fail_tags: ['any'], - progress: true + progress: true, } end rescue LoadError => e diff --git a/libraries/base_resource_logical_volume.rb b/libraries/base_resource_logical_volume.rb index a246ceb7..a942c6dc 100644 --- a/libraries/base_resource_logical_volume.rb +++ b/libraries/base_resource_logical_volume.rb @@ -58,7 +58,7 @@ def name(arg = nil) end, "cannot contain the strings '_mlog' or '_mimage'" => proc do |value| !value.match(/.*(_mlog|_mimage).*/) - end + end, } ) end @@ -160,7 +160,7 @@ def mount_point(arg = nil) value[:location] =~ %r{^/[^\0]*} end !matches.nil? - end + end, } ) end diff --git a/libraries/provider_lvm_logical_volume.rb b/libraries/provider_lvm_logical_volume.rb index 0b8cddb4..ff394a2a 100644 --- a/libraries/provider_lvm_logical_volume.rb +++ b/libraries/provider_lvm_logical_volume.rb @@ -298,7 +298,7 @@ def device_formatted?(device_name, fs_type) # Do not raise when there is an error in running the blkid command. If the exitstatus is not 0, # the device is perhaps not formatted. blkid = shell_out("blkid -o value -s TYPE #{device_name}") - blkid.exitstatus == 0 && blkid.stdout.strip == fs_type.strip + blkid.exitstatus.zero? && blkid.stdout.strip == fs_type.strip end end end diff --git a/libraries/provider_lvm_physical_volume.rb b/libraries/provider_lvm_physical_volume.rb index 148291b9..eb3f2ba6 100644 --- a/libraries/provider_lvm_physical_volume.rb +++ b/libraries/provider_lvm_physical_volume.rb @@ -71,7 +71,7 @@ def action_resize # get the amount of space that cannot be allocated non_allocatable_space = block_device_raw_size % pe_size # if it's an exact amount LVM appears to just take 1 full extent - non_allocatable_space = pe_size if non_allocatable_space == 0 + non_allocatable_space = pe_size if non_allocatable_space.zero? block_device_allocatable_size = block_device_raw_size - non_allocatable_space diff --git a/libraries/resource_lvm_logical_volume.rb b/libraries/resource_lvm_logical_volume.rb index d22995f0..b788b582 100644 --- a/libraries/resource_lvm_logical_volume.rb +++ b/libraries/resource_lvm_logical_volume.rb @@ -67,7 +67,7 @@ def stripes(arg = nil) arg, kind_of: Integer, callbacks: { - 'must be greater than 0' => proc { |value| value > 0 } + 'must be greater than 0' => proc { |value| value > 0 }, } ) end @@ -84,7 +84,7 @@ def stripe_size(arg = nil) arg, kind_of: Integer, callbacks: { - 'must be a power of 2' => proc { |value| Math.log2(value) % 1 == 0 } + 'must be a power of 2' => proc { |value| Math.log2(value) % 1.zero? }, } ) end @@ -101,7 +101,7 @@ def mirrors(arg = nil) arg, kind_of: Integer, callbacks: { - 'must be greater than 0' => proc { |value| value > 0 } + 'must be greater than 0' => proc { |value| value > 0 }, } ) end diff --git a/libraries/resource_lvm_volume_group.rb b/libraries/resource_lvm_volume_group.rb index 7f2e99f4..96bc87b0 100644 --- a/libraries/resource_lvm_volume_group.rb +++ b/libraries/resource_lvm_volume_group.rb @@ -63,7 +63,7 @@ def name(arg = nil) callbacks: { "cannot be '.' or '..'" => proc do |value| !(value == '.' || value == '..') - end + end, } ) end diff --git a/test/fixtures/cookbooks/test/recipes/create.rb b/test/fixtures/cookbooks/test/recipes/create.rb index 88d6be52..274e4446 100644 --- a/test/fixtures/cookbooks/test/recipes/create.rb +++ b/test/fixtures/cookbooks/test/recipes/create.rb @@ -18,6 +18,12 @@ # apt_update 'update' if platform_family?('debian') + +# install the old gems to make sure the uninstall works +chef_gem ['di-chef-ruby-lvm-attrib', 'di-chef-ruby-lvm'] do + compile_time true +end + include_recipe 'lvm' # The test device to use @@ -29,7 +35,7 @@ '/dev/loop4', '/dev/loop5', '/dev/loop6', - '/dev/loop7' + '/dev/loop7', ] extend Chef::Mixin::ShellOut diff --git a/test/fixtures/cookbooks/test/recipes/create_thin.rb b/test/fixtures/cookbooks/test/recipes/create_thin.rb index 94d37f29..a4fd9491 100644 --- a/test/fixtures/cookbooks/test/recipes/create_thin.rb +++ b/test/fixtures/cookbooks/test/recipes/create_thin.rb @@ -24,7 +24,7 @@ '/dev/loop0', '/dev/loop1', '/dev/loop2', - '/dev/loop3' + '/dev/loop3', ] extend Chef::Mixin::ShellOut