awspec 0.62.0 → 0.62.1

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: 3b28100b1878c194fcd42a0efac49424c7d08539
4
- data.tar.gz: a8057019286ff6106a243f10b48fe60805bbfc5d
3
+ metadata.gz: e39a73e41965600fce45012b4d6e7488162a9989
4
+ data.tar.gz: 8b1f51e39b8f834bf1bc76589288fbd135dc1f6a
5
5
  SHA512:
6
- metadata.gz: cc55cbd2da9bfc4d78e57049490cf97775dbd7760b8d653fda00406b6864861ffa2ae3c91b0c99ca3657fcf9d5f15ea37ad574c2809971b59b1b3ea341a00d65
7
- data.tar.gz: e586a79328767f2107f6020600b6e788ed0bd96318c92cdaca28b1fe771a3b77f4569fd39aac081b4b057badb7bb09fe34f487738f97a2e0ef3c37ae02b88395
6
+ metadata.gz: 1ea9915dbc828828e0c8854243062dae403d811b85e22ec53f2f88baaeed01d8a95b314bb08c20fca206ec39e7b6df06cf057fd4380e174360cd6e9091b0c9d0
7
+ data.tar.gz: 902e0ad0f05da4ab1ec57412d580689d0cbdcbe5e82dfb1452462787a97e2a5e8b6464ae1d6ef41dfe53a1aa60dfbee2102e82a32d3f63fe7747ae33c99f84f9
@@ -17,6 +17,7 @@ module Awspec::Generator
17
17
  end
18
18
 
19
19
  def generate_grant_specs(acl)
20
+ return [] unless acl
20
21
  linespecs = []
21
22
  acl.grants.each do |grant|
22
23
  linespecs.push(ERB.new(grant_linetemplate, nil, '-').result(binding))
@@ -36,8 +37,10 @@ it { should have_acl_grant(grantee: '<%= #{grantee} %>', permission: '<%= grant.
36
37
  template = <<-'EOF'
37
38
  describe s3_bucket('<%= bucket.name %>') do
38
39
  it { should exist }
40
+ <%- if acl -%>
39
41
  its(:acl_owner) { should eq '<%= acl.owner.display_name %>' }
40
42
  its(:acl_grants_count) { should eq <%= acl.grants.count %> }
43
+ <%- end -%>
41
44
  <% grant_specs.each do |line| %>
42
45
  <%= line %>
43
46
  <% end %>
@@ -54,7 +57,8 @@ EOF
54
57
  def content(bucket)
55
58
  acl = find_bucket_acl(bucket.name)
56
59
  grant_specs = generate_grant_specs(acl)
57
- bucket_policy = find_bucket_policy(bucket.name).policy.read
60
+ policy = find_bucket_policy(bucket.name)
61
+ bucket_policy = policy.policy.read if policy
58
62
  ERB.new(bucket_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
59
63
  end
60
64
  end
@@ -10,31 +10,31 @@ module Awspec::Helper
10
10
 
11
11
  def find_bucket_acl(id)
12
12
  s3_client.get_bucket_acl(bucket: id)
13
- rescue Aws::S3::Errors::NoSuchBucket
13
+ rescue Aws::S3::Errors::ServiceError
14
14
  nil
15
15
  end
16
16
 
17
17
  def find_bucket_cors(id)
18
18
  s3_client.get_bucket_cors(bucket: id)
19
- rescue Aws::S3::Errors::NoSuchBucket
19
+ rescue Aws::S3::Errors::ServiceError
20
20
  nil
21
21
  end
22
22
 
23
23
  def find_bucket_policy(id)
24
24
  s3_client.get_bucket_policy(bucket: id)
25
- rescue Aws::S3::Errors::NoSuchBucket
25
+ rescue Aws::S3::Errors::ServiceError
26
26
  nil
27
27
  end
28
28
 
29
29
  def find_bucket_logging(id)
30
30
  s3_client.get_bucket_logging(bucket: id)
31
- rescue Aws::S3::Errors::NoSuchBucket
31
+ rescue Aws::S3::Errors::ServiceError
32
32
  nil
33
33
  end
34
34
 
35
35
  def find_bucket_versioning(id)
36
36
  s3_client.get_bucket_versioning(bucket: id)
37
- rescue Aws::S3::Errors::NoSuchBucket
37
+ rescue Aws::S3::Errors::ServiceError
38
38
  nil
39
39
  end
40
40
 
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '0.62.0'
2
+ VERSION = '0.62.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.62.0
4
+ version: 0.62.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW