This file is indexed.

/usr/lib/ruby/vendor_ruby/fog/core/current_machine.rb is in ruby-fog-core 1.45.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
require "thread"

module Fog
  class CurrentMachine
    @lock = Mutex.new

    AMAZON_AWS_CHECK_IP = "http://checkip.amazonaws.com"

    def self.ip_address=(ip_address)
      @lock.synchronize do
        @ip_address = ip_address
      end
    end

    # Get the ip address of the machine from which this command is run. It is
    # recommended that you surround calls to this function with a timeout block
    # to ensure optimum performance in the case where the amazonaws checkip
    # service is unavailable.
    #
    # @example Get the current ip address
    #   begin
    #     Timeout::timeout(5) do
    #       puts "Your ip address is #{Fog::CurrentMachine.ip_address}"
    #     end
    #   rescue Timeout::Error
    #     puts "Service timeout"
    #   end
    #
    # @raise [Excon::Errors::Error] if the net/http request fails.
    def self.ip_address
      @lock.synchronize do
        @ip_address ||= Excon.get(AMAZON_AWS_CHECK_IP).body.chomp
      end
    end
  end
end