heirloom 0.12.5 → 0.12.7

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: 6e53875623addc8598279fefdfec8c4a71d29a68
4
- data.tar.gz: bcbc2a1ab5f612bc66a8a2b6f0f037fbb1a8bb0b
3
+ metadata.gz: ba2a3dde4a436f63dc663a4de637624667be848a
4
+ data.tar.gz: 1598f45ae046fa489d60414907f17b3d9bdaf6ab
5
5
  SHA512:
6
- metadata.gz: 00dc8d2c29b1d01cf3d6796cc82de0141f21cf9efb7e9c9fcc545ad6a59b49e9f1a27d5df4468db08cc041fc7a234b26d050d031378cfc52a9ab5d6653be14c2
7
- data.tar.gz: 555db1a43b07d64393361199307373706e7ebdb22a59e2fc07b44319d86233b0da141b166680884cc9b52cd6d5540fd88d04dd33b2af2ddfcd181b46543307e4
6
+ metadata.gz: d28c089db02df70b9eb5f992177318623ef580c04503b2f3b807e771fda36695c90b5499597d9f34eeab190596da735d9e046dbe1143c2e00b9abd9f439d5fb3
7
+ data.tar.gz: da2f5df3870707202895a317318b570cbade16b207a995090e3f87dd8d6104db8ba4778d78338759ca52776a0bfcb66b45c0c29f29d92e008257a97cd7da5623
@@ -1,3 +1,14 @@
1
+ ## head (04/21/2014):
2
+ * Added error handling for invalid account when accessing heirloom
3
+
4
+ ## 0.12.7
5
+
6
+ * Retry 503 errors from SimpleDB
7
+
8
+ ## 0.12.6
9
+
10
+ * Use fog 1.29.0
11
+
1
12
  ## 0.12.5 (04/03/2014):
2
13
 
3
14
  * Updated download CLI argument validation
data/README.md CHANGED
@@ -1,5 +1,15 @@
1
1
  [![Build Status](https://secure.travis-ci.org/intuit/heirloom.png)](http://travis-ci.org/intuit/heirloom)
2
2
  [![Code Climate](https://codeclimate.com/github/intuit/heirloom.png)](https://codeclimate.com/github/intuit/heirloom)
3
+
4
+ **Heirloom is in maintenance mode!**
5
+
6
+ **We will continue to provide support for bug fix requests, however new features will not be added.**
7
+
8
+ We recommend using the [AWS CLI](http://aws.amazon.com/cli/) and [GPG](https://www.gnupg.org/)
9
+ to distribute encrypted files in S3.
10
+
11
+ --------
12
+
3
13
  Heirloom
4
14
  ========
5
15
 
@@ -23,10 +23,11 @@ Gem::Specification.new do |s|
23
23
  s.add_development_dependency "rspec", '~> 2.14.1'
24
24
  s.add_development_dependency "simplecov"
25
25
 
26
- s.add_runtime_dependency 'fog', '= 1.21.0'
26
+ s.add_runtime_dependency 'fog', '= 1.29.0'
27
27
  s.add_runtime_dependency 'hashie', '= 2.0.5'
28
28
  s.add_runtime_dependency 'trollop', '= 2.0'
29
29
  s.add_runtime_dependency 'xml-simple', '~> 1.1.3'
30
30
  s.add_runtime_dependency "unf", "= 0.1.3"
31
31
  s.add_runtime_dependency "unf_ext", "= 0.0.6"
32
+ s.add_runtime_dependency "retries", "= 0.0.5"
32
33
  end
@@ -19,18 +19,12 @@ module Heirloom
19
19
 
20
20
  @logger.info "Authorizing #{@accounts.join(', ')}."
21
21
 
22
- key_name = reader.key_name
22
+ @key_name = reader.key_name
23
23
 
24
24
  regions.each do |region|
25
- bucket = reader.get_bucket :region => region
25
+ @bucket = reader.get_bucket :region => region
26
26
 
27
- s3_acl = ACL::S3.new :config => @config,
28
- :region => region
29
-
30
- s3_acl.allow_read_access_from_accounts :key_name => key_name,
31
- :key_folder => @name,
32
- :accounts => @accounts,
33
- :bucket => bucket
27
+ return false unless grant_read_access region
34
28
  end
35
29
 
36
30
  @logger.info "Authorization complete."
@@ -39,6 +33,16 @@ module Heirloom
39
33
 
40
34
  private
41
35
 
36
+ def grant_read_access(region)
37
+ s3_acl = ACL::S3.new :config => @config,
38
+ :region => region
39
+
40
+ s3_acl.allow_read_access_from_accounts :key_name => @key_name,
41
+ :key_folder => @name,
42
+ :accounts => @accounts,
43
+ :bucket => @bucket
44
+ end
45
+
42
46
  def validate_format_of_accounts
43
47
  status = true
44
48
 
@@ -94,6 +94,13 @@ module Heirloom
94
94
 
95
95
  def put_object_acl(bucket, key, grants)
96
96
  @s3.put_object_acl(bucket, key, grants)
97
+ true
98
+ rescue Excon::Errors::BadRequest => e
99
+ error = XmlSimple.xml_in e.response.body
100
+ error['Message'].each do |msg|
101
+ @logger.error msg
102
+ end
103
+ false
97
104
  end
98
105
 
99
106
  def put_bucket(bucket_name, region)
@@ -1,4 +1,5 @@
1
1
  require 'fog'
2
+ require 'retries'
2
3
 
3
4
  module Heirloom
4
5
  module AWS
@@ -20,8 +21,17 @@ module Heirloom
20
21
  @sdb = Fog::AWS::SimpleDB.new fog_args
21
22
  end
22
23
 
24
+ def retry_options
25
+ {:max_retries => 3,
26
+ :rescue => Excon::Errors::ServiceUnavailable,
27
+ :base_sleep_seconds => 10,
28
+ :max_sleep_seconds => 60}
29
+ end
30
+
23
31
  def domains
24
- @sdb.list_domains.body['Domains']
32
+ with_retries(retry_options) do
33
+ @sdb.list_domains.body['Domains']
34
+ end
25
35
  end
26
36
 
27
37
  def domain_exists?(domain)
@@ -29,11 +39,15 @@ module Heirloom
29
39
  end
30
40
 
31
41
  def create_domain(domain)
32
- @sdb.create_domain(domain) unless domain_exists?(domain)
42
+ with_retries(retry_options) do
43
+ @sdb.create_domain(domain) unless domain_exists?(domain)
44
+ end
33
45
  end
34
46
 
35
47
  def delete_domain(domain)
36
- @sdb.delete_domain(domain)
48
+ with_retries(retry_options) do
49
+ @sdb.delete_domain(domain)
50
+ end
37
51
  end
38
52
 
39
53
  def domain_empty?(domain)
@@ -41,7 +55,9 @@ module Heirloom
41
55
  end
42
56
 
43
57
  def put_attributes(domain, key, attributes, options = {})
44
- @sdb.put_attributes domain, key, attributes, options
58
+ with_retries(retry_options) do
59
+ @sdb.put_attributes domain, key, attributes, options
60
+ end
45
61
  end
46
62
 
47
63
  def select(query, opts = {})
@@ -52,7 +68,9 @@ module Heirloom
52
68
  logger.debug "Executing simpledb query '#{query}'."
53
69
 
54
70
  if opts[:offset] && opts[:offset] > 0
55
- limit = @sdb.select("#{query} limit #{opts[:offset]}").body
71
+ limit = with_retries(retry_options) do
72
+ @sdb.select("#{query} limit #{opts[:offset]}").body
73
+ end
56
74
  if limit['NextToken']
57
75
  logger.debug "Next token found. Retrieving results."
58
76
  next_token = limit['NextToken']
@@ -64,7 +82,9 @@ module Heirloom
64
82
 
65
83
  while has_more
66
84
  logger.debug "Retrieving results from next token '#{next_token}'." if next_token
67
- more = @sdb.select(query, 'NextToken' => next_token).body
85
+ more = with_retries(retry_options) do
86
+ @sdb.select(query, 'NextToken' => next_token).body
87
+ end
68
88
  more['Items'].each do |k, v|
69
89
  block_given? ? yield(k, v) : results[k] = v
70
90
  end
@@ -80,17 +100,23 @@ module Heirloom
80
100
  end
81
101
 
82
102
  def delete(domain, key)
83
- @sdb.delete_attributes domain, key
103
+ with_retries(retry_options) do
104
+ @sdb.delete_attributes domain, key
105
+ end
84
106
  end
85
107
 
86
108
  def count(domain)
87
- body = @sdb.select("SELECT count(*) FROM `#{domain}`").body
88
- body['Items']['Domain']['Count'].first.to_i
109
+ with_retries(retry_options) do
110
+ body = @sdb.select("SELECT count(*) FROM `#{domain}`").body
111
+ body['Items']['Domain']['Count'].first.to_i
112
+ end
89
113
  end
90
114
 
91
115
  def item_count(domain, item)
92
- query = "SELECT count(*) FROM `#{domain}` WHERE itemName() = '#{item}'"
93
- @sdb.select(query).body['Items']['Domain']['Count'].first.to_i
116
+ with_retries(retry_options) do
117
+ query = "SELECT count(*) FROM `#{domain}` WHERE itemName() = '#{item}'"
118
+ @sdb.select(query).body['Items']['Domain']['Count'].first.to_i
119
+ end
94
120
  end
95
121
 
96
122
  def logger
@@ -1,3 +1,3 @@
1
1
  module Heirloom
2
- VERSION = "0.12.5"
2
+ VERSION = "0.12.7"
3
3
  end
@@ -39,7 +39,7 @@ describe Heirloom do
39
39
  with(:key_name => '123.tar.gz',
40
40
  :key_folder => 'tim',
41
41
  :bucket => 'the-bucket',
42
- :accounts => accounts)
42
+ :accounts => accounts).and_return true
43
43
  @authorizer.authorize(:accounts => accounts,
44
44
  :regions => ['us-west-1', 'us-west-2']).
45
45
  should be_true
@@ -247,6 +247,16 @@ describe Heirloom do
247
247
  @s3.put_object_acl 'bucket', 'object', 'grants'
248
248
  end
249
249
 
250
+ it "should return true if Excon::Errors::BadRequest raised when account is invalid" do
251
+ body = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>UnresolvableGrantByEmailAddress</Code><Message>The e-mail address you provided does not match any account on record.</Message><RequestId>1FF76C053626CF97</RequestId><EmailAddress>brett@weav.net1</EmailAddress><HostId>AXpUoV59+WbDr++4ffoKlSdbFAlPjpoyJd5riKJ9bTZLoobnGRaboeeFmkkI7vg6</HostId></Error>'
252
+ @response_stub = stub 'response', :body => body
253
+
254
+ @fog_double.should_receive(:put_object_acl).
255
+ with('bucket', 'object', 'grants').
256
+ and_raise Excon::Errors::BadRequest.new 'msg', 'req', @response_stub
257
+ @s3.put_object_acl('bucket', 'object','grants').should be_false
258
+ end
259
+
250
260
  it "should call put bucket with location_constraint us-west-1" do
251
261
  options = { 'LocationConstraint' => 'us-west-1',
252
262
  'x-amz-acl' => 'private' }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heirloom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.5
4
+ version: 0.12.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Weaver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-03 00:00:00.000000000 Z
11
+ date: 2015-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 1.21.0
61
+ version: 1.29.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 1.21.0
68
+ version: 1.29.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: hashie
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - '='
137
137
  - !ruby/object:Gem::Version
138
138
  version: 0.0.6
139
+ - !ruby/object:Gem::Dependency
140
+ name: retries
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '='
144
+ - !ruby/object:Gem::Version
145
+ version: 0.0.5
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '='
151
+ - !ruby/object:Gem::Version
152
+ version: 0.0.5
139
153
  description: I help build and manage building tar.gz files and deploying them into
140
154
  the cloud
141
155
  email:
@@ -295,7 +309,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
295
309
  version: '0'
296
310
  requirements: []
297
311
  rubyforge_project: heirloom
298
- rubygems_version: 2.2.0
312
+ rubygems_version: 2.2.2
299
313
  signing_key:
300
314
  specification_version: 4
301
315
  summary: I help with deploying code into the cloud