tmpfs_mount_status

in cookbooks/fb_fstab/libraries/provider.rb [427:500]


    def tmpfs_mount_status(desired)
      
      
      
      fs_data = node.filesystem_data
      key = "#{desired['device']},#{desired['mount_point']}"
      if fs_data['by_pair'][key]
        mounted = fs_data['by_pair'][key].to_hash
        if mounted['fs_type'] == 'tmpfs'
          Chef::Log.debug(
            "fb_fstab: tmpfs #{desired['device']} on " +
            "#{desired['mount_point']} is currently mounted...",
          )
          if compare_opts(desired['opts'], mounted['mount_options'])
            Chef::Log.debug('fb_fstab: ... with identical options.')
            return :same
          else
            Chef::Log.debug(
              "fb_fstab: ... with different options #{desired['opts']} vs " +
              mounted['mount_options'].join(','),
            )
            Chef::Log.info(
              "fb_fstab: #{desired['mount_point']} is mounted with options " +
              "#{canonicalize_opts(mounted['mount_options'])} instead of " +
              canonicalize_opts(desired['opts']).to_s,
            )
            return :remount
          end
        end
      end
      
      
      
      if fs_data['by_mountpoint'][desired['mount_point']]
        
        mounted = fs_data['by_mountpoint'][desired['mount_point']].to_hash
        
        if mounted['fs_type'] == 'tmpfs'
          Chef::Log.warn(
            "fb_fstab: Treating #{mounted['devices']} on " +
            "#{desired['mount_point']} the same as #{desired['device']} on " +
            "#{desired['mount_point']} because they are both tmpfs.",
          )
          Chef::Log.debug(
            "fb_fstab: tmpfs #{desired['device']} on " +
            "#{desired['mount_point']} is currently mounted...",
          )
          Chef::Log.debug("fb_fstab: #{desired} vs #{mounted}")
          if compare_opts(desired['opts'], mounted['mount_options'])
            Chef::Log.debug('fb_fstab: ... with identical options.')
            return :same
          else
            Chef::Log.debug(
              "fb_fstab: ... with different options #{desired['opts']} vs " +
              mounted['mount_options'].join(','),
            )
            Chef::Log.info(
              "fb_fstab: #{desired['mount_point']} is mounted with options " +
              "#{canonicalize_opts(mounted['mount_options'])} instead of " +
              canonicalize_opts(desired['opts']).to_s,
            )
            return :remount
          end
        end
        Chef::Log.warn(
          "fb_fstab: tmpfs is desired on #{desired['mount_point']}, but " +
          "non-tmpfs #{mounted['devices']} (#{mounted['fs_type']}) currently " +
          'mounted there.',
        )
        return :conflict
      end
      :missing
    end