This file is indexed.

/usr/lib/ruby/vendor_ruby/specinfra/host_inventory.rb is in ruby-specinfra 2.35.1-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
61
62
63
64
65
66
67
68
module Specinfra
  class HostInventory
    KEYS = %w{
      memory
      ec2
      hostname
      domain
      fqdn
      platform
      platform_version
      filesystem
      cpu
      virtualization
      kernel
    }

    include Enumerable

    attr_reader :backend

    def self.instance
      property[:host_inventory] ||= {}
      self.new(Specinfra.backend, property[:host_inventory])
    end

    def initialize(backend, inventory = {})
      @backend = backend
      @inventory = inventory
    end

    def [](key)
      @inventory[key.to_sym] ||= {}
      if @inventory[key.to_sym].empty?
        begin
          inventory_class = Specinfra::HostInventory.const_get(key.to_s.to_camel_case)
          @inventory[key.to_sym] = inventory_class.new(self).get
        rescue
          @inventory[key.to_sym] = nil
        end
      end
      @inventory[key.to_sym]
    end

    def each
      KEYS.each do |k|
        yield k, self[k]
      end
    end

    def each_key
      KEYS.each do |k|
        yield k
      end
    end

    def each_value
      KEYS.each do |k|
        yield self[k]
      end
    end

  end
end

require "specinfra/host_inventory/base"
Specinfra::HostInventory::KEYS.each do |k|
  require "specinfra/host_inventory/#{k}"
end