ironfan 5.0.3 → 5.0.4

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/VERSION CHANGED
@@ -1 +1 @@
1
- 5.0.3
1
+ 5.0.4
data/ironfan.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ironfan"
8
- s.version = "5.0.3"
8
+ s.version = "5.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Infochimps"]
@@ -86,7 +86,7 @@ module Ironfan
86
86
 
87
87
  module ClassMethods
88
88
  def default_to_bidirectional default=true
89
- fields[:bidirectional].default = default
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), server_group_v, client_group_v) if bidirectional
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).authorize_group(group_2)
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
 
@@ -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) make_plugin(name, true); make_plugin(name, false); end
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
- make_plugin_pair(:bam); make_plugin_pair(:pow)
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.3
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: -590095215980804344
413
+ hash: -19121079596515349
414
414
  required_rubygems_version: !ruby/object:Gem::Requirement
415
415
  none: false
416
416
  requirements: