This file is indexed.

/usr/share/puppet/modules.available/puppetlabs-apache/lib/puppet/provider/a2mod/redhat.rb is in puppet-module-puppetlabs-apache 3.0.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
require 'puppet/provider/a2mod'

Puppet::Type.type(:a2mod).provide(:redhat, parent: Puppet::Provider::A2mod) do
  desc 'Manage Apache 2 modules on RedHat family OSs'

  commands apachectl: 'apachectl'

  confine osfamily: :redhat
  defaultfor osfamily: :redhat

  require 'pathname'

  # modpath: Path to default apache modules directory /etc/httpd/mod.d
  # modfile: Path to module load configuration file; Default: resides under modpath directory
  # libfile: Path to actual apache module library. Added in modfile LoadModule

  attr_accessor :modfile, :libfile
  class << self
    attr_accessor :modpath
    def preinit
      @modpath = '/etc/httpd/mod.d'
    end
  end

  preinit

  def create
    File.open(modfile, 'w') do |f|
      f.puts "LoadModule #{resource[:identifier]} #{libfile}"
    end
  end

  def destroy
    File.delete(modfile)
  end

  def self.instances
    modules = apachectl('-M').lines.map { |line|
      m = line.match(%r{(\w+)_module \(shared\)$})
      m[1] if m
    }.compact

    modules.map do |mod|
      new(
        name: mod,
        ensure: :present,
        provider: :redhat,
      )
    end
  end

  def modfile
    "#{self.class.modpath}/#{resource[:name]}.load"
  end

  # Set libfile path: If absolute path is passed, then maintain it. Else, make it default from 'modules' dir.
  def libfile
    Pathname.new(resource[:lib]).absolute? ? resource[:lib] : "modules/#{resource[:lib]}"
  end
end