ironfan 5.0.3 → 5.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/ironfan.gemspec +1 -1
- data/lib/ironfan/dsl/component.rb +6 -6
- data/spec/ironfan/plugin_spec.rb +62 -3
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.0.
|
1
|
+
5.0.4
|
data/ironfan.gemspec
CHANGED
@@ -86,7 +86,7 @@ module Ironfan
|
|
86
86
|
|
87
87
|
module ClassMethods
|
88
88
|
def default_to_bidirectional default=true
|
89
|
-
|
89
|
+
magic :bidirectional, :boolean, default: default
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
@@ -109,9 +109,9 @@ module Ironfan
|
|
109
109
|
# FIXME: This is Ec2-specific and probably doesn't belong here.
|
110
110
|
client_group_v = client_group(compute)
|
111
111
|
server_group_v = server_group(cluster_name, facet_name)
|
112
|
-
|
113
|
-
group_edge(compute.cloud(:ec2), client_group_v, server_group_v)
|
114
|
-
group_edge(compute.cloud(:ec2),
|
112
|
+
|
113
|
+
group_edge(compute.cloud(:ec2), client_group_v, :authorized_by_group, server_group_v)
|
114
|
+
group_edge(compute.cloud(:ec2), client_group_v, :authorize_group, server_group_v) if bidirectional
|
115
115
|
|
116
116
|
Chef::Log.debug("discovered #{announce_name} for #{cluster_name}: #{discovery}")
|
117
117
|
end
|
@@ -126,8 +126,8 @@ module Ironfan
|
|
126
126
|
"#{realm_name}_#{server_cluster}"
|
127
127
|
end
|
128
128
|
|
129
|
-
def group_edge(cloud, group_1, group_2)
|
130
|
-
cloud.security_group(group_1).
|
129
|
+
def group_edge(cloud, group_1, method, group_2)
|
130
|
+
cloud.security_group(group_1).send(method, group_2)
|
131
131
|
Chef::Log.debug("component.rb: allowing access from security group #{group_1} to #{group_2}")
|
132
132
|
end
|
133
133
|
|
data/spec/ironfan/plugin_spec.rb
CHANGED
@@ -87,11 +87,16 @@ describe Ironfan::Dsl::Component do
|
|
87
87
|
|
88
88
|
context 'when announcing' do
|
89
89
|
before (:each) do
|
90
|
-
def make_plugin(name, server_b)
|
90
|
+
def make_plugin(name, server_b, bidirectional)
|
91
91
|
Ironfan::Dsl::Component.template([name, server_b ? 'server' : 'client']) do
|
92
92
|
include Ironfan::Dsl::Component::Announcement if server_b
|
93
93
|
include Ironfan::Dsl::Component::Discovery if not server_b
|
94
94
|
|
95
|
+
if bidirectional and not server_b
|
96
|
+
STDERR.puts("defaulting #{name} to bidirectional")
|
97
|
+
default_to_bidirectional
|
98
|
+
end
|
99
|
+
|
95
100
|
if server_b
|
96
101
|
def project(compute)
|
97
102
|
end
|
@@ -103,9 +108,63 @@ describe Ironfan::Dsl::Component do
|
|
103
108
|
end
|
104
109
|
end
|
105
110
|
|
106
|
-
def make_plugin_pair(name
|
111
|
+
def make_plugin_pair(name, bidirectional = false)
|
112
|
+
make_plugin(name, true, bidirectional);
|
113
|
+
make_plugin(name, false, bidirectional);
|
114
|
+
end
|
115
|
+
|
116
|
+
make_plugin_pair(:bam)
|
117
|
+
make_plugin_pair(:pow)
|
118
|
+
make_plugin_pair(:zap, true)
|
119
|
+
|
120
|
+
Ironfan.realm(:wap) do
|
121
|
+
cloud(:ec2)
|
122
|
+
|
123
|
+
cluster(:foo) do
|
124
|
+
bam_client{ server_cluster :bar }
|
125
|
+
pow_server
|
126
|
+
end
|
127
|
+
|
128
|
+
cluster(:bar) do
|
129
|
+
bam_server
|
130
|
+
pow_client{ server_cluster :foo }
|
131
|
+
end
|
132
|
+
|
133
|
+
cluster(:baz) do
|
134
|
+
zap_client{ server_cluster :bif }
|
135
|
+
end
|
136
|
+
|
137
|
+
cluster(:bif) do
|
138
|
+
zap_server
|
139
|
+
end
|
140
|
+
end.resolve!
|
141
|
+
end
|
142
|
+
|
143
|
+
after(:each) do
|
144
|
+
[:BamServer, :BamClient, :PowServer,
|
145
|
+
:PowClient, :ZapClient, :ZapServer].each do |class_name|
|
146
|
+
Ironfan::Dsl::Component.send(:remove_const, class_name)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'configures the correct security groups during discovery' do
|
151
|
+
foo_group = Ironfan.realm(:wap).cluster(:foo).cloud(:ec2).security_group('wap_foo')
|
152
|
+
bar_group = Ironfan.realm(:wap).cluster(:bar).cloud(:ec2).security_group('wap_bar')
|
153
|
+
|
154
|
+
foo_group.group_authorized_by.should include('wap_bar')
|
155
|
+
bar_group.group_authorized_by.should include('wap_foo')
|
156
|
+
end
|
157
|
+
|
158
|
+
it 'configures the correct security groups during bidirectional discovery' do
|
159
|
+
baz_group = Ironfan.realm(:wap).cluster(:baz).cloud(:ec2).security_group('wap_baz')
|
160
|
+
bif_group = Ironfan.realm(:wap).cluster(:bif).cloud(:ec2).security_group('wap_bif')
|
161
|
+
|
162
|
+
baz_group.group_authorized_by.should include('wap_bif')
|
163
|
+
baz_group.group_authorized.should include('wap_bif')
|
164
|
+
end
|
107
165
|
|
108
|
-
|
166
|
+
it 'does not configure extra security groups during bidirectional discovery' do
|
167
|
+
Ironfan.realm(:wap).cluster(:baz).cloud(:ec2).security_groups.keys.should_not include('wap_bif')
|
109
168
|
end
|
110
169
|
end
|
111
170
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ironfan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -410,7 +410,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
410
410
|
version: '0'
|
411
411
|
segments:
|
412
412
|
- 0
|
413
|
-
hash: -
|
413
|
+
hash: -19121079596515349
|
414
414
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
415
415
|
none: false
|
416
416
|
requirements:
|