File: swift-commented-fstab-entries.rb

package info (click to toggle)
puppet-module-swift 25.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,400 kB
  • sloc: ruby: 9,593; python: 38; sh: 10; makefile: 10
file content (21 lines) | stat: -rw-r--r-- 579 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# module_name/lib/facter/swift-commented-fstab-entries
Facter.add(:swift_commented_fstab_entries) do
  setcode do
    myhash = {}
    File.open('/etc/fstab').readlines.each{ |line|
      if line.match('^[#]*UUID=')
        mountpoint = line.split[1]
        if mountpoint.match('^/srv/node/')
          drivename = mountpoint.gsub('/srv/node/', '')
          if line.match('^#')
            c = { drivename => 'commented' }
          else
            c = { drivename => 'active' }
          end
          myhash = myhash.merge(c)
        end
      end
    }
    myhash
  end
end