vanagon 0.39.1 → 0.39.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vanagon/component/source.rb +5 -2
- data/lib/vanagon/component.rb +9 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bbab09cfcd3f8a91841bb070ac6fbdd57b37ba5833e4992f3c2251df12c825a
|
4
|
+
data.tar.gz: 1a14dea7853f5e623ae1d8fbccf35f63d5fb63c2ab6b9c013ce50bc37a2ba791
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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::
|
59
|
-
"
|
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)
|
data/lib/vanagon/component.rb
CHANGED
@@ -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
|
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
|
-
#
|
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.
|
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-
|
11
|
+
date: 2023-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|