Class: Facts::Linux::Partitions

Inherits:
Object
  • Object
show all
Defined in:
lib/facter/facts/linux/partitions.rb

Constant Summary collapse

FACT_NAME =
'partitions'

Instance Method Summary collapse

Instance Method Details

#call_the_resolverObject



8
9
10
# File 'lib/facter/facts/linux/partitions.rb', line 8

def call_the_resolver
  Facter::ResolvedFact.new(FACT_NAME, partitions)
end

#partitionsObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/facter/facts/linux/partitions.rb', line 12

def partitions
  parts = Facter::Resolvers::Partitions.resolve(:partitions)
  mountpoints = Facter::Resolvers::Mountpoints.resolve(:mountpoints)
  return parts unless mountpoints

  mountpoints.reverse_each do |mnt|
    next unless parts[mnt[:device]]

    parts[mnt[:device]].merge!(mount: mnt[:path])
  end
  parts.empty? ? nil : parts
end