lib/facter/resolvers/mountpoints_resolver.rb in facter-4.0.46 vs lib/facter/resolvers/mountpoints_resolver.rb in facter-4.0.47
- old
+ new
@@ -1,11 +1,11 @@
# frozen_string_literal: true
module Facter
module Resolvers
class Mountpoints < BaseResolver
- include Facter::FilesystemHelper
+ include Facter::Util::Resolvers::FilesystemHelper
init_resolver
@log = Facter::Log.new(self)
@@ -15,11 +15,11 @@
def post_resolve(fact_name)
@fact_list.fetch(fact_name) { read_mounts(fact_name) }
end
def root_device
- cmdline = Util::FileHelper.safe_read('/proc/cmdline')
+ cmdline = Facter::Util::FileHelper.safe_read('/proc/cmdline')
match = cmdline.match(/root=([^\s]+)/)
root = match&.captures&.first
if !root.nil? && root.include?('=')
# We are dealing with the PARTUUID of the partition. Need to extract partition path.
@@ -43,11 +43,11 @@
device
end
def read_mounts(fact_name)
mounts = []
- FilesystemHelper.read_mountpoints.each do |file_system|
+ Facter::Util::Resolvers::FilesystemHelper.read_mountpoints.each do |file_system|
mount = {}
get_mount_data(file_system, mount)
next if mount[:path] =~ %r{^/(proc|sys)} && mount[:filesystem] != 'tmpfs' || mount[:filesystem] == 'autofs'
@@ -65,19 +65,19 @@
mount[:path] = file_system.mount_point
mount[:options] = file_system.options.split(',').map(&:strip)
end
def get_mount_sizes(mount)
- stats = FilesystemHelper.read_mountpoint_stats(mount[:path])
+ stats = Facter::Util::Resolvers::FilesystemHelper.read_mountpoint_stats(mount[:path])
get_bytes_data(mount, stats)
total_bytes = mount[:used_bytes] + mount[:available_bytes]
- mount[:capacity] = FilesystemHelper.compute_capacity(mount[:used_bytes], total_bytes)
+ mount[:capacity] = Facter::Util::Resolvers::FilesystemHelper.compute_capacity(mount[:used_bytes], total_bytes)
- mount[:size] = Facter::FactsUtils::UnitConverter.bytes_to_human_readable(mount[:size_bytes])
- mount[:available] = Facter::FactsUtils::UnitConverter.bytes_to_human_readable(mount[:available_bytes])
- mount[:used] = Facter::FactsUtils::UnitConverter.bytes_to_human_readable(mount[:used_bytes])
+ mount[:size] = Facter::Util::Facts::UnitConverter.bytes_to_human_readable(mount[:size_bytes])
+ mount[:available] = Facter::Util::Facts::UnitConverter.bytes_to_human_readable(mount[:available_bytes])
+ mount[:used] = Facter::Util::Facts::UnitConverter.bytes_to_human_readable(mount[:used_bytes])
end
def get_bytes_data(mount, stats)
mount[:size_bytes] = stats.bytes_total.abs
mount[:available_bytes] = stats.bytes_available.abs