def query_metadata_agent(path)
      url = "#{@metadata_agent_url}/#{path}"
      @log.debug("Calling Metadata Agent: #{url}")
      open(url) do |f|
        response = f.read
        parsed_hash = parse_json_or_nil(response)
        if parsed_hash.nil?
          @log.error 'Response from Metadata Agent is not in valid json ' \
                     "format: '#{response.inspect}'."
          return nil
        end
        @log.debug "Response from Metadata Agent: #{parsed_hash}"
        return parsed_hash
      end
    rescue StandardError => e
      @log.error "Error calling Metadata Agent at #{url}.", error: e
      nil
    end
def query_metadata_agent(path)
      url = "#{@metadata_agent_url}/#{path}"
      @log.debug("Calling Metadata Agent: #{url}")
      open(url) do |f|
        response = f.read
        parsed_hash = parse_json_or_nil(response)
        if parsed_hash.nil?
          @log.error 'Response from Metadata Agent is not in valid json ' \
                     "format: '#{response.inspect}'."
          return nil
        end
        @log.debug "Response from Metadata Agent: #{parsed_hash}"
        return parsed_hash
      end
    rescue StandardError => e
      @log.error "Error calling Metadata Agent at #{url}.", error: e
      nil
    end
Issue a request to the Metadata Agent's local API and parse the response
 to JSON. Return nil in case of failure.