awspec 0.62.0 → 0.62.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/awspec/generator/spec/s3_bucket.rb +5 -1
- data/lib/awspec/helper/finder/s3.rb +5 -5
- data/lib/awspec/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e39a73e41965600fce45012b4d6e7488162a9989
|
4
|
+
data.tar.gz: 8b1f51e39b8f834bf1bc76589288fbd135dc1f6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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::
|
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::
|
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::
|
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::
|
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::
|
37
|
+
rescue Aws::S3::Errors::ServiceError
|
38
38
|
nil
|
39
39
|
end
|
40
40
|
|
data/lib/awspec/version.rb
CHANGED