miasma 0.2.26 → 0.2.28

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: f2845acc35f272e51fc8089eee658042c7a6d4b3
4
- data.tar.gz: 52ac10e0bd6fb1cd6d69adbe3964a7843d4ffd47
3
+ metadata.gz: 3b2d18aa4668b4cd91f5d0c98895983fbded4a0d
4
+ data.tar.gz: 203bbd13208a023c62f71d6c30d034df3043af82
5
5
  SHA512:
6
- metadata.gz: dc57cc9f7fcaee18c30a50729fa3e51af1c44347474db1eb2fcec9bc79d82ad7456bca2fc397dc3264c32f5e201e9c3d4bbf9e77277a4d5f5feb066a4d864cf7
7
- data.tar.gz: bf0e77ce3a6ef2f6a9850bfbc25add286114236934c01dc664b46e03db7eabd04c4caa38ba46099aa012762da5c2dc06b187952b4df1a8a4276501e1aac55a60
6
+ metadata.gz: 5ff97e15e0702de0fb9606bcba54de85730416d666235dfe70050d2a19c2d88202d70228e511fbd5626d0b4d575fb82d06b09b27ecdba5452c7f507e1c63b2eb
7
+ data.tar.gz: c8873ed07fb88bf5375f1b2f2db2f21647dbf22bfcdc1e0d7f1a1f6dd663f1299fcc2191bfc9eb1f74b952f6a7795616bb15c7985af50d8beccc1b40939fbfee
@@ -1,3 +1,7 @@
1
+ # v0.2.28
2
+ * Include original exception information on API load failures
3
+ * Provide better retry functionality on non-modify requests
4
+
1
5
  # v0.2.26
2
6
  * Update Collection#get to not match name if nil
3
7
 
@@ -48,7 +48,7 @@ module Miasma
48
48
  raise Error.new "Failed to locate requested API type #{args[:type].inspect} for #{args[:provider].inspect}"
49
49
  end
50
50
  rescue NameError => e
51
- raise Error.new "Failed to locate requested API type #{args[:type].inspect}"
51
+ raise Error.new "Failed to load requested API type #{args[:type].inspect} (Reason: #{e.class} - #{e})"
52
52
  end
53
53
  end
54
54
 
@@ -10,8 +10,6 @@ module Miasma
10
10
  VALID_REQUEST_RETRY_METHODS=[:get, :head]
11
11
  # Maximum allowed HTTP request retries (for non-HTTP related errors)
12
12
  MAX_REQUEST_RETRIES=5
13
- # Seconds to pause between retries
14
- REQUEST_RETRY_DELAY=0.5
15
13
 
16
14
  include Miasma::Utils::Lazy
17
15
  include Miasma::Utils::Memoization
@@ -111,10 +109,11 @@ module Miasma
111
109
  _connection = connection
112
110
  end
113
111
  result = retryable_request(http_method) do
114
- make_request(_connection, http_method, request_args)
115
- end
116
- unless([args.fetch(:expects, 200)].flatten.compact.map(&:to_i).include?(result.code))
117
- raise Error::ApiError::RequestError.new(result.reason, :response => result)
112
+ res = make_request(_connection, http_method, request_args)
113
+ unless([args.fetch(:expects, 200)].flatten.compact.map(&:to_i).include?(res.code))
114
+ raise Error::ApiError::RequestError.new(res.reason, :response => res)
115
+ end
116
+ res
118
117
  end
119
118
  format_response(result, !args[:disable_body_extraction])
120
119
  end
@@ -126,19 +125,15 @@ module Miasma
126
125
  # @param http_method [Symbol] HTTP request method
127
126
  # @yield request to be retried if allowed
128
127
  # @return [Object] result of block
129
- def retryable_request(http_method)
130
- attempts = VALID_REQUEST_RETRY_METHODS.include?(http_method) ? 0 :nil
131
- begin
132
- yield
133
- rescue => e
134
- if(attempts && attempts < MAX_REQUEST_RETRIES)
135
- attempts += 1
136
- sleep REQUEST_RETRY_DELAY
137
- retry
138
- else
139
- raise
140
- end
141
- end
128
+ def retryable_request(http_method, &block)
129
+ Bogo::Retry.build(
130
+ data.fetch(:retry_type, :exponential),
131
+ :max_attempts => VALID_REQUEST_RETRY_METHODS.include?(http_method) ? data.fetch(:retry_max, MAX_REQUEST_RETRIES) : 1,
132
+ :wait_interval => data[:retry_interval],
133
+ :ui => data[:retry_ui],
134
+ :auto_run => false,
135
+ &block
136
+ ).run!
142
137
  end
143
138
 
144
139
  # Perform request
@@ -1,4 +1,4 @@
1
1
  module Miasma
2
2
  # current library version
3
- VERSION = Gem::Version.new('0.2.26')
3
+ VERSION = Gem::Version.new('0.2.28')
4
4
  end
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.add_runtime_dependency 'multi_json'
15
15
  s.add_runtime_dependency 'multi_xml'
16
16
  s.add_runtime_dependency 'xml-simple'
17
- s.add_runtime_dependency 'bogo', '>= 0.1.20', '< 1.0'
17
+ s.add_runtime_dependency 'bogo', '>= 0.1.27', '< 1.0'
18
18
  # Include provider libs that do not have outside deps
19
19
  s.add_runtime_dependency 'miasma-aws'
20
20
  s.add_runtime_dependency 'miasma-open-stack'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miasma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.26
4
+ version: 0.2.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-21 00:00:00.000000000 Z
11
+ date: 2015-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -72,7 +72,7 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.1.20
75
+ version: 0.1.27
76
76
  - - "<"
77
77
  - !ruby/object:Gem::Version
78
78
  version: '1.0'
@@ -82,7 +82,7 @@ dependencies:
82
82
  requirements:
83
83
  - - ">="
84
84
  - !ruby/object:Gem::Version
85
- version: 0.1.20
85
+ version: 0.1.27
86
86
  - - "<"
87
87
  - !ruby/object:Gem::Version
88
88
  version: '1.0'
@@ -262,3 +262,4 @@ signing_key:
262
262
  specification_version: 4
263
263
  summary: Smoggy API
264
264
  test_files: []
265
+ has_rdoc: