File: oci_etc_hosts_content.rb

package info (click to toggle)
openstack-cluster-installer 43.0.22
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 4,544 kB
  • sloc: php: 19,169; sh: 18,137; ruby: 75; makefile: 31; xml: 8
file content (22 lines) | stat: -rw-r--r-- 439 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# module_name/lib/facter/oci_etc_hosts_content.rb
Facter.add(:oci_etc_hosts_content) do
  setcode do
    # return content of foo as a string
    doprint = 1
    myvar = ''

    File.open('/etc/hosts').readlines.each{ |line|
      if line =~ /OCISTA_MAINTAINED/
        doprint = 0
      end
      if doprint == 1
        myvar << line
      end
      if line =~ /OCIFIN_MAINTAINED/
        doprint = 1
      end
    }

    myvar
  end
end