bin/check-fs-writable.rb in sensu-plugins-filesystem-checks-0.1.0 vs bin/check-fs-writable.rb in sensu-plugins-filesystem-checks-0.2.0

- old
+ new

@@ -75,39 +75,39 @@ # Get the mount points from the self namespace # def acquire_mnt_pts mnt_pts = [] vol_groups = acquire_vol_groups.split("\n") - vol_groups.each do |vol_group| + vol_groups.each do |vol_group| `grep #{vol_group} /proc/self/mounts | awk '{print $2, $4}' | awk -F, '{print $1}' | awk '{print $1, $2}'`.split("\n").each do |mnt| mnt_pts << mnt end end mnt_pts end # Does proc list the mount point as rw # def rw_in_proc?(mount_info) - mount_info.each do |pt| - @crit_pt_proc << "#{pt.split[0]}" if pt.split[1] != 'rw' + mount_info.each do |pt| + @crit_pt_proc << pt.split[0].to_s if pt.split[1] != 'rw' end end # Create a tempfile at each mount point and attempt to write a line to it # If it can't write the line, or the mount point does not exist it will # generate a critical error # def rw_test?(mount_info) mount_info.each do |pt| - (Dir.exist? pt.split[0]) || (@crit_pt_test << "#{pt.split[0]}") + (Dir.exist? pt.split[0]) || (@crit_pt_test << pt.split[0].to_s) file = Tempfile.new('.sensu', pt.split[0]) puts "The temp file we are writing to is: #{file.path}" if config[:debug] # #YELLOW # need to add a check here to validate permissions, if none it pukes - file.write('mops') || @crit_pt_test << "#{pt.split[0]}" - file.read || @crit_pt_test << "#{pt.split[0]}" + file.write('mops') || @crit_pt_test << pt.split[0].to_s + file.read || @crit_pt_test << pt.split[0].to_s file.close file.unlink end end @@ -131,16 +131,16 @@ # If it can't write the line, or the mount point does not exist it will # generate a critical error # def manual_test config[:dir].each do |d| - (Dir.exist? d) || (@crit_pt_test << "#{d}") + (Dir.exist? d) || (@crit_pt_test << d.to_s) file = Tempfile.new('.sensu', d) puts "The temp file we are writing to is: #{file.path}" if config[:debug] # #YELLOW # need to add a check here to validate permissions, if none it pukes - file.write('mops') || @crit_pt_test << "#{d}" - file.read || @crit_pt_test << "#{d}" + file.write('mops') || @crit_pt_test << d.to_s + file.read || @crit_pt_test << d.to_s file.close file.unlink end end