vanagon 0.39.1 → 0.39.2

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: 4fe169a867215743c1234c1dc7611f6747040505867c94f05379e2e789e1ef22
4
- data.tar.gz: d663402a3ff359291b83a970e59ea8e9ce3b3101ba1a5d443e38b2372018ffa4
3
+ metadata.gz: 0bbab09cfcd3f8a91841bb070ac6fbdd57b37ba5833e4992f3c2251df12c825a
4
+ data.tar.gz: 1a14dea7853f5e623ae1d8fbccf35f63d5fb63c2ab6b9c013ce50bc37a2ba791
5
5
  SHA512:
6
- metadata.gz: 1c58c68372fb374b8ea3d3d016473e32bc41d76632f42dd76bcdef99a375b8758198fd1b193231932746d8c219cce8131817a43bc4c2597f8be2477c52f02d3f
7
- data.tar.gz: 18e74e97521b6db5596d746ff6628f932bdfd0b69670987588063a8f6b688a4ce3e0bfcd9d2f6159af68f5f9c3a47a2336267a928e10e0adf35d3e7b4cdd9f29
6
+ metadata.gz: f167828ef7a0012965b349b670fa4c3b3712bdb6065ae0ced63acca1ec8b909b850ada729cf4151271c62781f4576e088b8f5289de12e94f3748c64f311fdb4a
7
+ data.tar.gz: 4ab66f44f2b4fabd72ab2fa42c00bd4f3756b4dc9681c1ba05d2715fdacf82092327f297986f3fe872cdf3e306195d1fa3ee66b1ba9e2c8cf575e61b8b5386ae
@@ -3,8 +3,11 @@ require 'vanagon/logger'
3
3
  require 'vanagon/component/source/http'
4
4
  require 'vanagon/component/source/git'
5
5
  require 'vanagon/component/source/local'
6
+ require 'vanagon/errors'
6
7
 
7
8
  class Vanagon
9
+ class InvalidSource < Vanagon::Error
10
+ end
8
11
  class Component
9
12
  class Source
10
13
  SUPPORTED_PROTOCOLS = %w[file http https git].freeze
@@ -55,8 +58,8 @@ class Vanagon
55
58
  end
56
59
 
57
60
  # Unknown source type!
58
- raise Vanagon::Error,
59
- "Unknown file type: '#{uri}'; cannot continue"
61
+ raise Vanagon::InvalidSource,
62
+ "Source is invalid or of an unknown type: '#{uri}'; cannot continue"
60
63
  end
61
64
 
62
65
  def determine_source_type(uri)
@@ -260,14 +260,21 @@ class Vanagon
260
260
  VanagonLogger.info %(Attempting to fetch from mirror URL "#{mirror}")
261
261
  @source = Vanagon::Component::Source.source(mirror, **options)
262
262
  return true if source.fetch
263
+ rescue Vanagon::InvalidSource
264
+ # This means that the URL was not a git repo or a valid downloadable file,
265
+ # which means either the URL is incorrect, or we don't have access to that
266
+ # resource. Return false, so that the pkg.url value can be used instead.
267
+ VanagonLogger.error %(Invalid source "#{mirror}")
263
268
  rescue SocketError
264
269
  # SocketError means that there was no DNS/name resolution
265
270
  # for whatever remote protocol the mirror tried to use.
266
271
  VanagonLogger.error %(Unable to resolve mirror URL "#{mirror}")
267
- rescue RuntimeError
272
+ rescue StandardError
268
273
  # Source retrieval does not consistently return a meaningful
269
274
  # namespaced error message, which means we're brute-force rescuing
270
- # RuntimeError. Not a good look, and we should fix this.
275
+ # StandardError. Also, we want to handle other unexpected things when
276
+ # we try reaching out to the URL, so that we can gracefully return
277
+ # false and fall back to fetching the pkg.url value instead.
271
278
  VanagonLogger.error %(Unable to retrieve mirror URL "#{mirror}")
272
279
  end
273
280
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vanagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.39.1
4
+ version: 0.39.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet By Perforce
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-25 00:00:00.000000000 Z
11
+ date: 2023-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt