cloudkeeper 1.4.2 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1358dc8f5002e70611207126243b106695182838
4
- data.tar.gz: 3665cac985a187a948f973ab8ea30f1295c660c0
3
+ metadata.gz: adda5085537bff99cf6928e41f903c6ac1ebca8d
4
+ data.tar.gz: b10b49306646a737bd09956dedb04031087ef97e
5
5
  SHA512:
6
- metadata.gz: 0bf08fabfc72f259b5a962bff5a4d0d98092e8dac9679f1a2da8b2057317f0c2a65a5e73e833bba04a9e0bed2efa554b2415aa1433e2a2aa111699cd20383686
7
- data.tar.gz: 4009178fe581c3c416ad48d048bf54b290cf450f4d96f87a917fb7106223799be594daed75f3ff9d48773a21e7144eda9ffe840a438812154506a71f89b95a85
6
+ metadata.gz: fd66199e62985e93a4fd09a252903d975e5c109a15909984df73edd599a43e2878204341a0536b371134d4477f4c319519ca05d92aa45e439301f098cdb23d27
7
+ data.tar.gz: b781937419f1194da141c0a41fd5d5c074f4e01d4ae9114d7691927fe06b68c6cc89895273e31a3e24bdd80aff91ad149d956c13e0912678edbca970ddb8ec7f
@@ -33,7 +33,7 @@ module Cloudkeeper
33
33
  image_lists[image_list.identifier] = image_list
34
34
  rescue Cloudkeeper::Errors::ImageList::DownloadError, Cloudkeeper::Errors::ImageList::VerificationError,
35
35
  Cloudkeeper::Errors::Parsing::ParsingError => ex
36
- logger.warn "Image list #{url} couldn't be donwloaded\n#{ex.message}"
36
+ logger.warn "Image list #{url} couldn't be downloaded\n#{ex.message}"
37
37
  next
38
38
  end
39
39
  end
@@ -55,12 +55,14 @@ module Cloudkeeper
55
55
  raise Cloudkeeper::Errors::ImageList::RetrievalError,
56
56
  "couldn't download image list from url #{url.inspect}\n#{response.to_hash.inspect}"
57
57
  rescue Cloudkeeper::Errors::ImageList::RetrievalError, Cloudkeeper::Errors::InvalidURLError, ::IOError,
58
- ::Faraday::ConnectionFailed => ex
58
+ ::Faraday::ConnectionFailed, ::Faraday::SSLError => ex
59
59
  raise Cloudkeeper::Errors::ImageList::DownloadError, ex
60
60
  end
61
61
 
62
62
  def make_request(uri)
63
- conn = Faraday.new url: uri
63
+ ssl = {}
64
+ ssl = { ca_path: Cloudkeeper::Settings[:'ca-dir'], cert_store: OpenSSL::X509::Store.new } if Cloudkeeper::Settings[:'ca-dir']
65
+ conn = Faraday.new url: uri, ssl: ssl
64
66
  conn.get
65
67
  end
66
68
 
@@ -62,8 +62,7 @@ module Cloudkeeper
62
62
  end
63
63
 
64
64
  def retrieve_image(uri, filename)
65
- use_ssl = uri.scheme == 'https'
66
- Net::HTTP.start(uri.host, uri.port, use_ssl: use_ssl) do |http|
65
+ Net::HTTP.start(uri.host, uri.port, connection_options(uri)) do |http|
67
66
  request = Net::HTTP::Get.new(uri)
68
67
 
69
68
  http.request(request) do |response|
@@ -77,10 +76,17 @@ module Cloudkeeper
77
76
  end
78
77
  end
79
78
  rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Errno::ECONNREFUSED, Net::HTTPBadResponse,
80
- Net::HTTPHeaderSyntaxError, EOFError, Net::HTTPServerException, Net::HTTPRetriableError => ex
79
+ Net::HTTPHeaderSyntaxError, EOFError, Net::HTTPServerException, Net::HTTPRetriableError,
80
+ OpenSSL::SSL::SSLError => ex
81
81
  raise Cloudkeeper::Errors::NetworkConnectionError, ex
82
82
  end
83
83
 
84
+ def connection_options(uri)
85
+ use_ssl = uri.scheme == 'https'
86
+ ca_path = Cloudkeeper::Settings[:'ca-dir'] if Cloudkeeper::Settings[:'ca-dir']
87
+ { use_ssl: use_ssl, ca_path: ca_path }
88
+ end
89
+
84
90
  def generate_filename(uri)
85
91
  File.join(Cloudkeeper::Settings[:'image-dir'], Zaru.sanitize!(File.basename(uri.path)))
86
92
  end
@@ -1,3 +1,3 @@
1
1
  module Cloudkeeper
2
- VERSION = '1.4.2'.freeze
2
+ VERSION = '1.5.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudkeeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Kimle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-09 00:00:00.000000000 Z
11
+ date: 2017-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler