(self)
return result
Creates a map of mounted filesystems on the machine.

        iostat(1): Each sector has size of 512 bytes.

        Returns:
          st_dev -> FileSystem(device, mount_point)
Creates a map of mounted filesystems on the machine.
Creates a map of mounted filesystems on the machine .
def get_file_systems(self):
        """
        Creates a map of mounted filesystems on the machine.

        iostat(1): Each sector has size of 512 bytes.

        Returns:
          st_dev -> FileSystem(device, mount_point)
        """
        result = {}
        if os.access('/proc/mounts', os.R_OK):
            file = open('/proc/mounts')
            for line in file:
                try:
                    mount = line.split()
                    device = mount[0]
                    mount_point = mount[1]
                    fs_type = mount[2]
                except (IndexError, ValueError):
                    continue

                # Skip the filesystem if it is not in the list of valid
                # filesystems
                if fs_type not in self.filesystems:
                    self.log.debug("Ignoring %s since it is of type %s " +
                                   " which is not in the list of filesystems.",
                                   mount_point, fs_type)
                    continue

                # Process the filters
                if self.exclude_reg.search(mount_point):
                    self.log.debug("Ignoring %s since it is in the " +
                                   "exclude_filter list.", mount_point)
                    continue

                if ((('/' in device or ':' in device or device == 'tmpfs') and
                     mount_point.startswith('/'))):
                    try:
                        stat = os.stat(mount_point)
                    except OSError:
                        self.log.debug("Path %s is not mounted - skipping.",
                                       mount_point)
                        continue

                    if stat.st_dev in result:
                        continue

                    result[stat.st_dev] = {
                        'device': os.path.realpath(device),
                        'mount_point': mount_point,
                        'fs_type': fs_type
                    }

            file.close()

        else:
            if not psutil:
                self.log.error('Unable to import psutil')
                return None

            partitions = psutil.disk_partitions(False)
            for partition in partitions:
                result[len(result)] = {
                    'device': os.path.realpath(partition.device),
                    'mount_point': partition.mountpoint,
                    'fs_type': partition.fstype
                }
            pass

        return result
def get_file_systems ( self ) : result = { } if os . access ( '/proc/mounts' , os . R_OK ) : file = open ( '/proc/mounts' ) for line in file : try : mount = line . split ( ) device = mount [ 0 ] mount_point = mount [ 1 ] fs_type = mount [ 2 ] except ( IndexError , ValueError ) : continue # Skip the filesystem if it is not in the list of valid # filesystems if fs_type not in self . filesystems : self . log . debug ( "Ignoring %s since it is of type %s " + " which is not in the list of filesystems." , mount_point , fs_type ) continue # Process the filters if self . exclude_reg . search ( mount_point ) : self . log . debug ( "Ignoring %s since it is in the " + "exclude_filter list." , mount_point ) continue if ( ( ( '/' in device or ':' in device or device == 'tmpfs' ) and mount_point . startswith ( '/' ) ) ) : try : stat = os . stat ( mount_point ) except OSError : self . log . debug ( "Path %s is not mounted - skipping." , mount_point ) continue if stat . st_dev in result : continue result [ stat . st_dev ] = { 'device' : os . path . realpath ( device ) , 'mount_point' : mount_point , 'fs_type' : fs_type } file . close ( ) else : if not psutil : self . log . error ( 'Unable to import psutil' ) return None partitions = psutil . disk_partitions ( False ) for partition in partitions : result [ len ( result ) ] = { 'device' : os . path . realpath ( partition . device ) , 'mount_point' : partition . mountpoint , 'fs_type' : partition . fstype } pass return result