vm_shepherd 1.6.1 → 1.7.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65cd3b777476ef982c70b4c99fc270ce34f0084a
4
- data.tar.gz: b5f22dfd3e3111c58816f5e9260b53e1cfbd868a
3
+ metadata.gz: f9dff91e8705699b028d932fca884d70920cd183
4
+ data.tar.gz: 574acbac07103a58ec844d9aec09b5a4de2b38e6
5
5
  SHA512:
6
- metadata.gz: 3c48b1d7f31e478ede8d86e5834689d22db887e879b6031fdcebf72c33067d6b80676f6313fbac27ab600e90c445d1d35ac5eb1009d5b3ea295d40df77f5b1ba
7
- data.tar.gz: cc6ebc49f345869086b765fcd2971abf7b768737ae7d8404ae2a226dea441afc2b0bcac1ccbea5f958c85723bf67b250b76599eecc82ba6b4fd0bd0d72934499
6
+ metadata.gz: 1428e5edecb8f5f3cd0fbe3a0551fe379fe318027a39567fe52971df159202a6cd9bb9070a717664e2dc326056815b85bd553d7a88a6a61d3b0b440cac58f027
7
+ data.tar.gz: 11360f94e2f18c126d54e18c20ccfbf1d72a68c8b3eba2a305df85e532409eba0f411dc4650a13cb39cc013711090a4b2eb88dfc89e6f3237f2b9bfb1d5a834d
@@ -50,7 +50,7 @@ module VmShepherd
50
50
  end
51
51
  end
52
52
 
53
- if (elb_config = env_config[:elb])
53
+ env_config.fetch(:elbs, []).each do |elb_config|
54
54
  create_elb(stack, elb_config)
55
55
  end
56
56
  end
@@ -213,13 +213,15 @@ module VmShepherd
213
213
  end
214
214
 
215
215
  def ami_elb_config
216
- if settings.vm_shepherd.env_config.elb
216
+ if settings.vm_shepherd.env_config.elbs
217
217
  {
218
- elb: {
219
- name: settings.vm_shepherd.env_config.elb.name,
220
- port_mappings: settings.vm_shepherd.env_config.elb.port_mappings,
221
- stack_output_keys: settings.vm_shepherd.env_config.elb.stack_output_keys.to_h,
222
- }
218
+ elbs: settings.vm_shepherd.env_config.elbs.map do |elb|
219
+ {
220
+ name: elb.name,
221
+ port_mappings: elb.port_mappings,
222
+ stack_output_keys: elb.stack_output_keys.to_h,
223
+ }
224
+ end
223
225
  }
224
226
  else
225
227
  {}
@@ -1,3 +1,3 @@
1
1
  module VmShepherd
2
- VERSION = '1.6.1'.freeze
2
+ VERSION = '1.7.0'.freeze
3
3
  end
@@ -15,12 +15,17 @@ vm_shepherd:
15
15
  public_subnet_id: public-subnet-id
16
16
  private_subnet_id: private-subnet-id
17
17
  s3_bucket_name: bucket-name
18
- elb:
19
- name: some-elb-name
18
+ elbs:
19
+ - name: elb-1-name
20
20
  port_mappings: [[1111,11]]
21
21
  stack_output_keys:
22
22
  vpc_id: CloudFormationVpcIdOutputKey
23
23
  subnet_id: CloudFormationSubnetIdOutputKey
24
+ - name: elb-2-name
25
+ port_mappings: [[2222,22]]
26
+ stack_output_keys:
27
+ vpc_id: CloudFormationVpcIdOutputKey
28
+ subnet_id: CloudFormationSubnetIdOutputKey
24
29
  vm_configs:
25
30
  - vm_name: vm-name
26
31
  - vm_name: vm-name-2
@@ -108,14 +108,24 @@ module VmShepherd
108
108
  context 'when the elb setting is present' do
109
109
  let(:extra_configs) do
110
110
  {
111
- elb: {
112
- name: 'elb-name',
113
- port_mappings: [[1111, 11]],
114
- stack_output_keys: {
115
- vpc_id: 'vpc_id',
116
- subnet_id: 'private_subnet',
117
- },
118
- },
111
+ elbs: [
112
+ {
113
+ name: 'elb-1-name',
114
+ port_mappings: [[1111, 11]],
115
+ stack_output_keys: {
116
+ vpc_id: 'vpc_id',
117
+ subnet_id: 'private_subnet',
118
+ },
119
+ },
120
+ {
121
+ name: 'elb-2-name',
122
+ port_mappings: [[2222, 22]],
123
+ stack_output_keys: {
124
+ vpc_id: 'vpc_id',
125
+ subnet_id: 'private_subnet',
126
+ },
127
+ }
128
+ ],
119
129
  }
120
130
  end
121
131
  let(:stack) do
@@ -151,7 +161,7 @@ module VmShepherd
151
161
  allow(elb_client).to receive(:create_load_balancer)
152
162
  end
153
163
 
154
- it 'creates and attaches a security group' do
164
+ it 'creates and attaches a security group for the first ELB' do
155
165
  security_group_args = {
156
166
  group_name: 'fake-stack-name',
157
167
  description: 'ELB Security Group',
@@ -163,9 +173,9 @@ module VmShepherd
163
173
  ami_manager.prepare_environment(cloudformation_template_file.path)
164
174
  end
165
175
 
166
- it 'attaches an elb with the name of the stack' do
176
+ it 'attaches an elb with the name of the stack for the first ELB' do
167
177
  elb_params = {
168
- load_balancer_name: 'elb-name',
178
+ load_balancer_name: 'elb-1-name',
169
179
  listeners: [
170
180
  {protocol: 'TCP', load_balancer_port: 1111, instance_protocol: 'TCP', instance_port: 11},
171
181
  ],
@@ -176,6 +186,32 @@ module VmShepherd
176
186
 
177
187
  ami_manager.prepare_environment(cloudformation_template_file.path)
178
188
  end
189
+
190
+ it 'creates and attaches a security group for the second ELB' do
191
+ security_group_args = {
192
+ group_name: 'fake-stack-name',
193
+ description: 'ELB Security Group',
194
+ vpc_id: 'fake-vpc-id',
195
+ }
196
+ expect(ec2_client).to receive(:create_security_group).with(security_group_args).and_return(create_security_group_response)
197
+ expect(elb_security_group).to receive(:authorize_ingress).with(:tcp, 2222, '0.0.0.0/0')
198
+
199
+ ami_manager.prepare_environment(cloudformation_template_file.path)
200
+ end
201
+
202
+ it 'attaches an elb with the name of the stack for the second ELB' do
203
+ elb_params = {
204
+ load_balancer_name: 'elb-2-name',
205
+ listeners: [
206
+ {protocol: 'TCP', load_balancer_port: 2222, instance_protocol: 'TCP', instance_port: 22},
207
+ ],
208
+ subnets: ['fake-subnet-id'],
209
+ security_groups: ['elb-security-group-id']
210
+ }
211
+ expect(elb_client).to receive(:create_load_balancer).with(elb_params)
212
+
213
+ ami_manager.prepare_environment(cloudformation_template_file.path)
214
+ end
179
215
  end
180
216
  end
181
217
 
@@ -30,14 +30,24 @@ module VmShepherd
30
30
  end
31
31
  let(:aws_elb_config) do
32
32
  {
33
- elb: {
34
- name: 'some-elb-name',
35
- port_mappings: [[1111, 11]],
36
- stack_output_keys: {
37
- vpc_id: 'CloudFormationVpcIdOutputKey',
38
- subnet_id: 'CloudFormationSubnetIdOutputKey',
39
- },
40
- },
33
+ elbs: [
34
+ {
35
+ name: 'elb-1-name',
36
+ port_mappings: [[1111, 11]],
37
+ stack_output_keys: {
38
+ vpc_id: 'CloudFormationVpcIdOutputKey',
39
+ subnet_id: 'CloudFormationSubnetIdOutputKey',
40
+ },
41
+ },
42
+ {
43
+ name: 'elb-2-name',
44
+ port_mappings: [[2222, 22]],
45
+ stack_output_keys: {
46
+ vpc_id: 'CloudFormationVpcIdOutputKey',
47
+ subnet_id: 'CloudFormationSubnetIdOutputKey',
48
+ },
49
+ }
50
+ ],
41
51
  }
42
52
  end
43
53
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vm_shepherd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ops Manager Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-17 00:00:00.000000000 Z
11
+ date: 2015-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-v1
@@ -195,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
195
  version: '0'
196
196
  requirements: []
197
197
  rubyforge_project:
198
- rubygems_version: 2.4.7
198
+ rubygems_version: 2.4.8
199
199
  signing_key:
200
200
  specification_version: 4
201
201
  summary: A tool for booting and tearing down Ops Manager VMs on various Infrastructures.