awspec 0.16.0 → 0.17.0

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: 0bb8a9241d1820e45eb6a89efa5c3155741ba7bd
4
- data.tar.gz: 015e4dd1c035b7f8bc3eab7dc8f43956ebe16ba7
3
+ metadata.gz: 079365d4a013ed8f6ef32f280e5698831094b170
4
+ data.tar.gz: f6bf2551315170c4d5fe7fe4823387067ac60c50
5
5
  SHA512:
6
- metadata.gz: 320d0f037df7d383fc57aa5eb15d2f875ae46ef65097f59da389001997fbe1850a3623ce914b9d543e055e6b3cdf91078e39ba027a21fd6c9c733736c73016eb
7
- data.tar.gz: 9cb8d832d86e157c4ffb23f29ed3d6437a2e110bac0f520c733647f07524036d1bd0141ca960abe3378aa272fabac0474d783363b64a1a227b79328391815a05
6
+ metadata.gz: d6237ae37aa33e1decc7ff2fe2ddb1cb86ed3ade49d9f158a6609e7ffd23740057af858c8fc88d0d2ccff9c0f4164edeba650dd5bf14dee9a4649c8b33c244f4
7
+ data.tar.gz: 6cba16c1621ba3617c6280cfbc6d00322efbb5b6667c1d5a594b93795ed09831b544db40085c10bf183ab8ea10912f9d1a670ebbff2731745f5ae02023ee6993
@@ -28,7 +28,13 @@ module Awspec::Generator
28
28
  linespecs.push('its(:' + inout + ') { should be_opened }')
29
29
  next
30
30
  end
31
- port = permission.from_port
31
+
32
+ if permission.from_port == permission.to_port
33
+ port = permission.from_port
34
+ else
35
+ port = "'" + permission.from_port.to_s + '-' + permission.to_port.to_s + "'"
36
+ end
37
+
32
38
  protocol = permission.ip_protocol
33
39
  permission.ip_ranges.each do |ip_range|
34
40
  target = ip_range.cidr_ip
@@ -32,6 +32,17 @@ Aws.config[:ec2] = {
32
32
  group_name: 'group-name-sg'
33
33
  }
34
34
  ]
35
+ },
36
+ {
37
+ from_port: 50_000,
38
+ to_port: 50_009,
39
+ ip_protocol: 'tcp',
40
+ ip_ranges: [
41
+ {
42
+ cidr_ip: '123.456.789.012/32'
43
+ }
44
+ ],
45
+ user_id_group_pairs: []
35
46
  }
36
47
  ],
37
48
  ip_permissions_egress: [
@@ -23,7 +23,7 @@ module Awspec::Type
23
23
  next true unless port
24
24
  next true unless permission[:from_port]
25
25
  next true unless permission[:to_port]
26
- next false unless port.between?(permission[:from_port], permission[:to_port])
26
+ next false unless port_between?(port, permission[:from_port], permission[:to_port])
27
27
  next false if protocol && permission[:ip_protocol] != protocol
28
28
  next true unless cidr
29
29
  ret = permission[:ip_ranges].select do |ip_range|
@@ -47,7 +47,7 @@ module Awspec::Type
47
47
  next true unless port
48
48
  next true unless permission[:from_port]
49
49
  next true unless permission[:to_port]
50
- next false unless port.between?(permission[:from_port], permission[:to_port])
50
+ next false unless port_between?(port, permission[:from_port], permission[:to_port])
51
51
  next false if protocol && permission[:ip_protocol] != protocol
52
52
  next true unless cidr
53
53
  ret = permission[:ip_ranges].select do |ip_range|
@@ -85,5 +85,17 @@ module Awspec::Type
85
85
  @resource[:ip_permissions_egress].count
86
86
  end
87
87
  alias_method :outbound_permissions_count, :ip_permissions_egress_count
88
+
89
+ private
90
+
91
+ def port_between?(port, from_port, to_port)
92
+ if port.is_a?(String) && port.include?('-')
93
+ f, t = port.split('-')
94
+ false unless from_port == f.to_i && to_port == t.to_i
95
+ else
96
+ false unless port.between?(from_port, to_port)
97
+ end
98
+ true
99
+ end
88
100
  end
89
101
  end
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '0.16.0'
2
+ VERSION = '0.17.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-02 00:00:00.000000000 Z
11
+ date: 2015-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec