elasticity 6.0.4 → 6.0.5

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: 5bfb7218cb99e8354fa0131b0abb59d4ff270871
4
- data.tar.gz: 824cc467d7beec5a50d63200d75805f4c8cb801e
3
+ metadata.gz: d313d736b8c2be8bda97c7cba0c200c611b5fc59
4
+ data.tar.gz: e0c4afadd4d192770e3c79a67f5c62147425c1dd
5
5
  SHA512:
6
- metadata.gz: 35806e42575b2be800ffaa2559f5e511b6c11c46eae4ad337744249f525146f2e4c800aaa2a19f00139036d848492407b1d2d09b7a84a896a29244d0664a8037
7
- data.tar.gz: 1ba0336770e3bef6dbcde18021902f44b880c717855224a5a6ce7e6f022eb69eafc2d41bc38808812b9dc13806931953e22b24f4063c85ad1160f4cbf0a84a67
6
+ metadata.gz: 2c3c35bdeb9408756f085cc9fc8550c6ca6165fec7134af6a8f639279128cb6bf2a84a067766891ead282e6532adbb5a1a2fa7aff6fa62ed65261171f8fb7f80
7
+ data.tar.gz: cbab3121a67c1b7f0d3370f6ee662b7dd308fa0d8c57122e68db1f2b0b1e5a87119533968baadfae8c3e4a5bbd76a94ae28a49f362e276fb42d68e34e9d58e8f
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ Gemfile.lock
4
4
  pkg/*
5
5
  .idea
6
6
  tmp/*
7
+ .DS_Store
data/HISTORY.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 6.0.5 - August 28, 2015
2
+
3
+ - - Including PR [#119](https://github.com/rslifka/elasticity/pull/119) - "Error handling for API rate limiting". Thank you [@robert2d](https://github.com/robert2d)!
4
+
1
5
  ## 6.0.4 - August 3, 2015
2
6
 
3
7
  - Including PR [#118](https://github.com/rslifka/elasticity/pull/118) - "jobflow ids must be passed as an array to AWS". Thank you [@robert2d](https://github.com/robert2d)!
@@ -1,9 +1,8 @@
1
1
  module Elasticity
2
2
 
3
- class MissingKeyError < StandardError;
4
- end
5
- class MissingRegionError < StandardError;
6
- end
3
+ class MissingKeyError < StandardError; end
4
+ class MissingRegionError < StandardError; end
5
+ class ThrottlingException < StandardError; end
7
6
 
8
7
  class AwsSession
9
8
 
@@ -29,7 +28,9 @@ module Elasticity
29
28
  begin
30
29
  RestClient.post(aws_request.url, aws_request.payload, aws_request.headers)
31
30
  rescue RestClient::BadRequest => e
32
- raise ArgumentError, AwsSession.parse_error_response(e.http_body)
31
+ type, message = AwsSession.parse_error_response(e.http_body)
32
+ raise ThrottlingException, message if type == 'ThrottlingException'
33
+ raise ArgumentError, message
33
34
  end
34
35
  end
35
36
 
@@ -45,7 +46,10 @@ module Elasticity
45
46
  # the error document.
46
47
  def self.parse_error_response(error_json)
47
48
  error = JSON.parse(error_json)
48
- "AWS EMR API Error (#{error['__type']}): #{error['message']}"
49
+ [
50
+ error['__type'],
51
+ "AWS EMR API Error (#{error['__type']}): #{error['message']}"
52
+ ]
49
53
  end
50
54
 
51
55
  end
@@ -1,3 +1,3 @@
1
1
  module Elasticity
2
- VERSION = '6.0.4'
2
+ VERSION = '6.0.5'
3
3
  end
@@ -123,7 +123,7 @@ describe Elasticity::AwsRequestV4 do
123
123
 
124
124
  describe '.aws_v4_signature' do
125
125
  it 'should create the proper signature' do
126
- subject.send(:aws_v4_signature).should == 'd58b9ceeb51d56225de948616432438063fe9261be05c8c9f95de15b0053f15a'
126
+ subject.send(:aws_v4_signature).should == '107261f2d6a4d5caa0b14c6be4aabd283f730ce11f1e855890553288b21e1f5a'
127
127
  end
128
128
  end
129
129
 
@@ -94,6 +94,16 @@ describe Elasticity::AwsSession do
94
94
  subject.submit({})
95
95
  }.to raise_error(ArgumentError, "AWS EMR API Error (#{error_type}): #{error_message}")
96
96
  end
97
+
98
+ context 'EMR API rate limit hit' do
99
+ let(:error_type) { 'ThrottlingException' }
100
+ it 'should raise a Throttling error with the body of the error' do
101
+ RestClient.should_receive(:post).and_raise(error)
102
+ expect {
103
+ subject.submit({})
104
+ }.to raise_error(Elasticity::ThrottlingException, "AWS EMR API Error (#{error_type}): #{error_message}")
105
+ end
106
+ end
97
107
  end
98
108
 
99
109
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticity
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.4
4
+ version: 6.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Slifka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-03 00:00:00.000000000 Z
11
+ date: 2015-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client