check_wanted_filesystems

in cookbooks/fb_fstab/libraries/provider.rb [619:706]


    def check_wanted_filesystems
      
      
      
      in_maint_disks = FB::Fstab.get_in_maint_disks
      in_maint_mounts = FB::Fstab.get_in_maint_mounts

      
      
      node['fb_fstab']['mounts'].to_hash.each_value do |desired_data|
        
        
        
        if desired_data['device'] == 'none'
          Chef::Log.warn('fb_fstab: We do not permit "none" devices, please ' +
                          'use a descriptive device name')
          next
        end

        if desired_data['type'] == 'swap'
          Chef::Log.debug('fb_fstab: We do not change swap from fb_fstab, ' +
                          'moving on...')
          next
        end

        if desired_data['opts']
          opt_list = desired_data['opts'].split(',')
          if opt_list.include?('noauto')
            Chef::Log.debug(
              "fb_fstab: '#{desired_data['device']}' is configured with " +
              "'noauto' option, we will not mount.",
            )
            next
          end
        end

        begin
          desired_data['device'] = canonicalize_device(desired_data['device'])
        rescue RuntimeError
          next if desired_data['allow_mount_failure']
        end

        status = mount_status(desired_data)

        case status
        when :same
          Chef::Log.debug(
            "fb_fstab: Skipping #{desired_data['mount_point']}; looks good!",
          )
          next
        when :missing
          converge_by "mount #{desired_data['mount_point']}" do
            mount(desired_data, in_maint_disks, in_maint_mounts)
          end
          
          next
        when :conflict
          
          Chef::Log.info(
            "fb_fstab: Skipping #{desired_data['mount_point']} due to conflict",
          )
          next
        when :moved
          Chef::Log.info(
            "fb_fstab: Skipping #{desired_data['mount_point']} since it " +
            'moved. Moving filesystems is scary.',
          )
          next
        when :remount
          base_msg = "fb_fstab: Mountpoint #{desired_data['mount_point']} " +
                     'options changed'
          if node['fb_fstab']['enable_remount'] &&
             desired_data['enable_remount']
            Chef::Log.debug("fb_fstab: #{base_msg} - remounting")
            converge_by "remount #{desired_data['mount_point']}" do
              remount(desired_data)
            end
            
            
            
            next
          else
            Chef::Log.warn("#{base_msg}, but remounts are not enabled")
          end
        end
      end
    end