should_keep

in cookbooks/fb_fstab/libraries/provider.rb [192:254]


    def should_keep(mounted_data, desired_mounts, base_mounts)
      Chef::Log.debug(
        "fb_fstab: Should we keep #{mounted_data}?",
      )
      
      desired_mounts.each_value do |desired_data|
        begin
          desired_device = canonicalize_device(desired_data['device'])
        rescue RuntimeError
          next if desired_data['allow_mount_failure']

          raise
        end
        Chef::Log.debug("fb_fstab: --> Lets see if it matches #{desired_data}")
        
        
        
        if mounted_data['device']&.start_with?('/dev/')
          if desired_device == mounted_data['device']
            Chef::Log.debug(
              "fb_fstab: Device #{mounted_data['device']} is supposed to be " +
              ' mounted, not considering for unmount',
            )
            return true
          end
        
        
        elsif desired_data['mount_point'] == mounted_data['mount'] &&
              compare_fstype(desired_data['type'], mounted_data['fs_type'])
          Chef::Log.debug(
            "fb_fstab: Virtual fs of type #{mounted_data['fs_type']} is " +
            "desired at #{mounted_data['mount']}, not considering for unmount",
          )
          return true
        end
        Chef::Log.debug('fb_fstab: --> ... nope')
      end

      
      if FB::Fstab.autofs_parent(mounted_data['mount'], node)
        Chef::Log.debug(
          "fb_fstab: #{mounted_data['device']} (#{mounted_data['mount']}) is" +
          ' autofs-controlled.',
        )
        return true
      end

      
      
      
      Chef::Log.debug('fb_fstab: --> OK, well is it a base mount?')
      if base_mounts[mounted_data['device']] &&
         base_mounts[mounted_data['device']]['mount_point'] ==
         mounted_data['mount']
        Chef::Log.debug(
          "fb_fstab: #{mounted_data['device']} on #{mounted_data['mount']} is" +
          ' a base mount, not considering for unmount',
        )
        return true
      end
      false
    end