Skip to content

Commit

Permalink
(FACT-2742) Catch NameError exception in base resolver. (#2030)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdan Irimie authored Aug 14, 2020
1 parent 54e882c commit 2dc7bab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/facter/resolvers/base_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def self.resolve(fact_name)
subscribe_to_manager
post_resolve(fact_name)
end
rescue LoadError => e
rescue LoadError, NameError => e
log.debug("resolving fact #{fact_name}, but #{e}")
@fact_list[fact_name] = nil
end
Expand Down
4 changes: 2 additions & 2 deletions lib/facter/resolvers/ec2.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require 'net/http'

module Facter
module Resolvers
class Ec2 < BaseResolver
Expand Down Expand Up @@ -52,6 +50,8 @@ def build_path_compoent(line)
end

def get_data_from(url)
require 'net/http'

parsed_url = URI.parse(url)
http = Net::HTTP.new(parsed_url.host)
http.read_timeout = determine_session_timeout
Expand Down

0 comments on commit 2dc7bab

Please sign in to comment.