Method: AugeasProviders::Mounttab::Fstab.get_resource

Defined in:
lib/augeasproviders/mounttab/fstab.rb

.get_resource(aug, mpath, target) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/augeasproviders/mounttab/fstab.rb', line 25

def self.get_resource(aug, mpath, target)
  entry = {
    :ensure => :present,
    :target => target
  }
  return nil unless entry[:name] = aug.get("#{mpath}/file")
  entry[:device] = aug.get("#{mpath}/spec")
  entry[:fstype] = aug.get("#{mpath}/vfstype")

  options = []
  aug.match("#{mpath}/opt").each do |opath|
    opt = aug.get(opath)
    optv = aug.get("#{opath}/value")
    opt = "#{opt}=#{optv}" if optv
    options << opt
  end
  entry[:options] = options
  entry[:pass] = aug.get("#{mpath}/passno") if aug.match("#{mpath}/passno")
  entry[:dump] = aug.get("#{mpath}/dump") if aug.match("#{mpath}/dump")

  entry
end