Sha256: 1101e082f42085a138b166faa3d2d99c1610912d6676b67876c9d151e3870275

Contents?: true

Size: 920 Bytes

Versions: 66

Compression:

Stored size: 920 Bytes

Contents

require 'fs/MiqFS/MiqFS'

module LinuxMountProbe
  LINUX_FS_TYPES   = %w( Ext3 ext3 Ext4 ext4 ReiserFS XFS )
  LINUX_ROOT_DIRS  = ["bin", "dev", "etc", "lib", "proc", "sbin", "usr"]
  LINUX_ROOT_FILES = ["/etc/fstab"]

  def self.probe(fs)
    unless LINUX_FS_TYPES.include?(fs.fsType)
      $log.info "LinuxMountProbe << FALSE because file system (#{fs.fsType}) is not supported" if $log
      return false
    end

    if (fs.dirEntries & LINUX_ROOT_DIRS).length != LINUX_ROOT_DIRS.length
      $log.debug "LinuxMountProbe << FALSE because root directories (#{LINUX_ROOT_DIRS.inspect}) missing in: #{fs.dirEntries.inspect}" if $log
      return false
    end

    LINUX_ROOT_FILES.each do |f|
      unless fs.fileExists?(f)
        $log.info "LinuxMountProbe << FALSE because file #{f} does not exist" if $log
        return false
      end
    end

    $log.debug "LinuxMountProbe << TRUE" if $log
    true
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
manageiq-smartstate-0.10.1 lib/fs/modules/LinuxMountProbe.rb
manageiq-smartstate-0.10.0 lib/fs/modules/LinuxMountProbe.rb
manageiq-smartstate-0.9.0 lib/fs/modules/LinuxMountProbe.rb
manageiq-smartstate-0.8.1 lib/fs/modules/LinuxMountProbe.rb
manageiq-smartstate-0.8.0 lib/fs/modules/LinuxMountProbe.rb
manageiq-smartstate-0.7.0 lib/fs/modules/LinuxMountProbe.rb
manageiq-smartstate-0.6.2 lib/fs/modules/LinuxMountProbe.rb
manageiq-smartstate-0.5.10 lib/fs/modules/LinuxMountProbe.rb
manageiq-smartstate-0.3.10 lib/fs/modules/LinuxMountProbe.rb
manageiq-smartstate-0.6.1 lib/fs/modules/LinuxMountProbe.rb
manageiq-smartstate-0.3.9 lib/fs/modules/LinuxMountProbe.rb
manageiq-smartstate-0.6.0 lib/fs/modules/LinuxMountProbe.rb
manageiq-smartstate-0.5.9 lib/fs/modules/LinuxMountProbe.rb
manageiq-smartstate-0.5.8 lib/fs/modules/LinuxMountProbe.rb
manageiq-smartstate-0.3.8 lib/fs/modules/LinuxMountProbe.rb
manageiq-smartstate-0.5.7 lib/fs/modules/LinuxMountProbe.rb
manageiq-smartstate-0.3.7 lib/fs/modules/LinuxMountProbe.rb
manageiq-smartstate-0.5.6 lib/fs/modules/LinuxMountProbe.rb
manageiq-smartstate-0.3.6 lib/fs/modules/LinuxMountProbe.rb
manageiq-smartstate-0.5.5 lib/fs/modules/LinuxMountProbe.rb