fauxhai-chef 9.3.16 → 9.4.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f417a9db8e9ed28a34f3a2e3171a94afaac56adfe2a851a7dda215009d258b2d
4
- data.tar.gz: dfabaf821a51753505a3c69b092159b630c6c594b272ce4f101619d953ecff52
3
+ metadata.gz: 40beeff2487b3b0ce772cfb4041251e72a86dc71eef86643dd7892feedfdb8e3
4
+ data.tar.gz: 496d19e2800125745db014ae39f47a02ee1dea025a6d8dff11be9e79823c484a
5
5
  SHA512:
6
- metadata.gz: 6af77fbbdecae5047ad823a3cf7bde8deca0e52b14d7c6130f60315e99672ca688f7c17c8f00c7dded3787066374e32d4b856cc3e6315351cbd986d81b477922
7
- data.tar.gz: c9f587e76cbecaba27d3f6f12f1343a4a78a672b3df9be6c549657bac2767c38193098b1c4184788b86a18cfa0219751d3c4aba80b67675c0c772e281f9b8c02
6
+ metadata.gz: 4678f6997bdd6b6b1b02a06f9dcd7aa2314fbaa5237f4eb14d48f5aec5dff017fbee46980b91464f37d2c11e1f7b65b829f546b94f3a7635c1a8b42e5976ab5a
7
+ data.tar.gz: 5105a5b070333fc2bfc7a342af9c4507ab6402a621650b5d89fd61aadc0d515dc9cefa04181470c4b60b36b6facb89991e38d7916ff6b0caa874435fe96e9540
data/Gemfile CHANGED
@@ -1,2 +1,7 @@
1
1
  source "https://rubygems.org"
2
+
2
3
  gemspec
4
+
5
+ group :development do
6
+ gem 'appbundler'
7
+ end
data/fauxhai-chef.gemspec CHANGED
@@ -12,16 +12,16 @@ Gem::Specification.new do |spec|
12
12
  spec.homepage = "https://github.com/chef/fauxhai"
13
13
  spec.license = "MIT"
14
14
 
15
- spec.required_ruby_version = ">= 2.7"
15
+ spec.required_ruby_version = ">= 3.1"
16
16
 
17
17
  spec.files = %w{LICENSE Gemfile fauxhai-chef.gemspec} + Dir.glob("{lib,bin}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }
18
18
  spec.executables = "fauxhai"
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_runtime_dependency "net-ssh"
22
+ spec.add_runtime_dependency "ohai", ">= 13.0"
22
23
 
23
24
  spec.add_development_dependency "chef", ">= 13.0"
24
- spec.add_development_dependency "ohai", ">= 13.0"
25
25
  spec.add_development_dependency "rake"
26
26
  spec.add_development_dependency "rspec", "~> 3.7"
27
27
  spec.add_development_dependency "rspec-its", "~> 1.2"
@@ -45,15 +45,16 @@ module Fauxhai
45
45
  elsif @options[:github_fetching]
46
46
  # Try loading from github (in case someone submitted a PR with a new file, but we haven't
47
47
  # yet updated the gem version). Cache the response locally so it's faster next time.
48
- require "open-uri" unless defined?(OpenURI)
48
+ require "net/http" unless defined?(Net::HTTP)
49
49
  begin
50
- response = URI.open("#{RAW_BASE}/lib/fauxhai/platforms/#{platform}/#{version}.json")
51
- rescue OpenURI::HTTPError
50
+ uri = URI("#{RAW_BASE}/lib/fauxhai/platforms/#{platform}/#{version}.json")
51
+ response = Net::HTTP.get_response(uri)
52
+ rescue StandardError
52
53
  raise Fauxhai::Exception::InvalidPlatform.new("Could not find platform '#{platform}/#{version}' on the local disk and an HTTP error was encountered when fetching from Github. #{PLATFORM_LIST_MESSAGE}")
53
54
  end
54
55
 
55
- if response.status.first.to_i == 200
56
- response_body = response.read
56
+ if response.code.to_i == 200
57
+ response_body = response.body
57
58
  path = Pathname.new(filepath)
58
59
  FileUtils.mkdir_p(path.dirname)
59
60
 
@@ -64,7 +65,7 @@ module Fauxhai
64
65
  end
65
66
  return parse_and_validate(response_body)
66
67
  else
67
- raise Fauxhai::Exception::InvalidPlatform.new("Could not find platform '#{platform}/#{version}' on the local disk and an Github fetching returned http error code #{response.status.first.to_i}! #{PLATFORM_LIST_MESSAGE}")
68
+ raise Fauxhai::Exception::InvalidPlatform.new("Could not find platform '#{platform}/#{version}' on the local disk and an Github fetching returned http error code #{response.code}! #{PLATFORM_LIST_MESSAGE}")
68
69
  end
69
70
  else
70
71
  raise Fauxhai::Exception::InvalidPlatform.new("Could not find platform '#{platform}/#{version}' on the local disk and Github fetching is disabled! #{PLATFORM_LIST_MESSAGE}")