fog-bouncer 0.0.6 → 0.0.8
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.
- data/fog-bouncer.gemspec +1 -1
- data/lib/fog/bouncer/group.rb +3 -1
- data/lib/fog/bouncer/security.rb +5 -3
- data/lib/fog/bouncer/sources.rb +11 -4
- data/lib/fog/bouncer/version.rb +1 -1
- data/spec/support/security/private.rb +1 -1
- metadata +3 -3
data/fog-bouncer.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ["dylanegan@gmail.com"]
|
7
7
|
gem.description = %q{A simple way to define and manage security groups for AWS with the backing support of fog.}
|
8
8
|
gem.summary = %q{A manage security.}
|
9
|
-
gem.homepage = ""
|
9
|
+
gem.homepage = "https://github.com/dylanegan/fog-bouncer"
|
10
10
|
|
11
11
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
12
|
gem.files = `git ls-files`.split("\n")
|
data/lib/fog/bouncer/group.rb
CHANGED
data/lib/fog/bouncer/security.rb
CHANGED
@@ -17,9 +17,9 @@ module Fog
|
|
17
17
|
@accounts ||= { 'amazon-elb' => 'amazon-elb', 'self' => Fog::Bouncer.aws_account_id }
|
18
18
|
end
|
19
19
|
|
20
|
-
def define(name,
|
20
|
+
def define(name, sources, &block)
|
21
21
|
raise SourceBlockRequired unless block_given?
|
22
|
-
@definitions[name] = {
|
22
|
+
@definitions[name] = { sources: Array(sources), block: block }
|
23
23
|
end
|
24
24
|
|
25
25
|
def definitions(name)
|
@@ -69,7 +69,9 @@ module Fog
|
|
69
69
|
|
70
70
|
@using.each do |definition|
|
71
71
|
@groups.each do |group|
|
72
|
-
|
72
|
+
definition[:sources].each do |source|
|
73
|
+
group.add_source(source, &definition[:block])
|
74
|
+
end
|
73
75
|
end
|
74
76
|
end
|
75
77
|
end
|
data/lib/fog/bouncer/sources.rb
CHANGED
@@ -5,16 +5,23 @@ module Fog
|
|
5
5
|
module Bouncer
|
6
6
|
module Sources
|
7
7
|
def self.for(source, group, &block)
|
8
|
-
|
8
|
+
begin
|
9
9
|
CIDR.new(source, group, &block)
|
10
|
-
|
11
|
-
|
10
|
+
rescue ArgumentError => e
|
11
|
+
if e.message =~ /Invalid IP/
|
12
|
+
Group.new(source, group, &block)
|
13
|
+
else
|
14
|
+
raise e
|
15
|
+
end
|
12
16
|
end
|
13
17
|
end
|
14
18
|
|
15
19
|
class CIDR < Fog::Bouncer::Source
|
20
|
+
attr_reader :ip
|
21
|
+
|
16
22
|
def initialize(source, group, &block)
|
17
|
-
|
23
|
+
@ip = IPAddress::IPv4.new(source)
|
24
|
+
source = @ip.to_string
|
18
25
|
super
|
19
26
|
end
|
20
27
|
|
data/lib/fog/bouncer/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-bouncer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: clamp
|
@@ -144,7 +144,7 @@ files:
|
|
144
144
|
- spec/fog/bouncer_spec.rb
|
145
145
|
- spec/helper.rb
|
146
146
|
- spec/support/security/private.rb
|
147
|
-
homepage:
|
147
|
+
homepage: https://github.com/dylanegan/fog-bouncer
|
148
148
|
licenses: []
|
149
149
|
post_install_message:
|
150
150
|
rdoc_options: []
|