class Facter::Resolvers::Aix::Mountpoints
Constants
- BLOCK_SIZE
Private Class Methods
add_mount_points_fact(line)
click to toggle source
# File lib/facter/resolvers/aix/mountpoints.rb, line 31 def add_mount_points_fact(line) elem = line.split("\s") if line[0] != ' ' server = elem.shift device = "#{server}:#{elem[0]}" else device = elem[0] end @fact_list[:mountpoints][elem[1]] = { device: device, filesystem: elem[2], options: elem.last.include?(':') ? [] : elem.last.split(',') } end
compute_sizes(info)
click to toggle source
# File lib/facter/resolvers/aix/mountpoints.rb, line 62 def compute_sizes(info) available_bytes = info[3] used_bytes = info[2] size_bytes = info[1] @fact_list[:mountpoints][info.last].merge!( capacity: Facter::Util::Resolvers::FilesystemHelper.compute_capacity(used_bytes, size_bytes), available_bytes: available_bytes, used_bytes: used_bytes, size_bytes: size_bytes, available: Facter::Util::Facts::UnitConverter.bytes_to_human_readable(available_bytes), used: Facter::Util::Facts::UnitConverter.bytes_to_human_readable(used_bytes), size: Facter::Util::Facts::UnitConverter.bytes_to_human_readable(size_bytes) ) end
post_resolve(fact_name, _options)
click to toggle source
# File lib/facter/resolvers/aix/mountpoints.rb, line 14 def post_resolve(fact_name, _options) @fact_list.fetch(fact_name) { read_mount(fact_name) } end
read_mount(fact_name)
click to toggle source
# File lib/facter/resolvers/aix/mountpoints.rb, line 18 def read_mount(fact_name) @fact_list[:mountpoints] = {} output = Facter::Core::Execution.execute('mount', logger: log) output.split("\n").drop(2).map do |line| next if /procfs|ahafs/.match?(line) add_mount_points_fact(line) end retrieve_sizes_for_mounts @fact_list[fact_name] end
retrieve_sizes_for_mounts()
click to toggle source
# File lib/facter/resolvers/aix/mountpoints.rb, line 45 def retrieve_sizes_for_mounts output = Facter::Core::Execution.execute('df -P', logger: log) output.split("\n").drop(1).map do |line| next if /-\s+-\s+-/.match?(line) mount_info = line.split("\s") mount_info[3] = translate_to_bytes(mount_info[3]) mount_info[2] = translate_to_bytes(mount_info[2]) mount_info[1] = translate_to_bytes(mount_info[1]) compute_sizes(mount_info) end end
translate_to_bytes(strin_size)
click to toggle source
# File lib/facter/resolvers/aix/mountpoints.rb, line 58 def translate_to_bytes(strin_size) strin_size.to_i * BLOCK_SIZE end