module Facter::Util::Resolvers::FilesystemHelper
Constants
- MOUNT_KEYS
Public Class Methods
compute_capacity(used, total)
click to toggle source
# File lib/facter/util/resolvers/filesystem_helper.rb, line 23 def compute_capacity(used, total) if used == total '100%' elsif used.positive? "#{format('%<value>.2f', value: (used / total.to_f * 100))}%" else '0%' end end
read_mountpoint_stats(path)
click to toggle source
# File lib/facter/util/resolvers/filesystem_helper.rb, line 18 def read_mountpoint_stats(path) require 'sys/filesystem' Sys::Filesystem.stat(path) end
read_mountpoints()
click to toggle source
# File lib/facter/util/resolvers/filesystem_helper.rb, line 11 def read_mountpoints # TODO: this require must be replaced with "require 'sys/filesystem'" when a new release of # djberg96/sys-filesystem gem is available require_relative '../../patches/sysfilesystem/sys/statvfs.rb' force_utf(Sys::Filesystem.mounts) end
Private Class Methods
force_utf(mounts)
click to toggle source
# File lib/facter/util/resolvers/filesystem_helper.rb, line 35 def force_utf(mounts) mounts.each do |mount| mount.name.force_encoding('UTF-8') mount.mount_type.force_encoding('UTF-8') mount.mount_point.force_encoding('UTF-8') mount.options.force_encoding('UTF-8') end end