vm_shepherd 1.5.4 → 1.6.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 +4 -4
- data/lib/vm_shepherd/aws_manager.rb +9 -3
- data/lib/vm_shepherd/version.rb +1 -1
- data/spec/vm_shepherd/aws_manager_spec.rb +22 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b205f1eac35569f69fe5709c0019c0fd51a6e86
|
4
|
+
data.tar.gz: 105cc945195c4300389ef2d5e208203ff5d35d6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b872bef61ea5d9f432b822aebd8cfb8de74f97312d104ffc68c452b15ce4ee6c691c336899dddf52835f5b59715f2c5f49caaa951c361e8ce6a551e5295e0bf3
|
7
|
+
data.tar.gz: fda97963ff3c34a9546c870d6e00b87897213f12ca4a4295fc19d46c4d8c0eea765a58260dd9b8d566764686122a48452a449a69d8797ddd71897ba053c21e3b
|
@@ -85,9 +85,15 @@ module VmShepherd
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
|
89
|
-
|
90
|
-
|
88
|
+
vm_ip_address = vm_config.fetch(:vm_ip_address, nil)
|
89
|
+
if vm_ip_address
|
90
|
+
logger.info('Associating existing IP to the instance')
|
91
|
+
elastic_ip = AWS::EC2::ElasticIp.new(vm_ip_address)
|
92
|
+
else
|
93
|
+
logger.info('Creating an Elastic IP and assigning it to the instance')
|
94
|
+
elastic_ip = AWS.ec2.elastic_ips.create(vpc: true)
|
95
|
+
end
|
96
|
+
instance.associate_elastic_ip(elastic_ip)
|
91
97
|
instance.add_tag('Name', value: vm_config.fetch(:vm_name))
|
92
98
|
end
|
93
99
|
|
data/lib/vm_shepherd/version.rb
CHANGED
@@ -238,13 +238,31 @@ module VmShepherd
|
|
238
238
|
expect { ami_manager.deploy(ami_file_path: ami_file_path, vm_config: vm_config) }.to raise_error(AwsManager::RetryLimitExceeded)
|
239
239
|
end
|
240
240
|
|
241
|
-
|
242
|
-
|
241
|
+
context 'vm configuration does not contain an elastic IP' do
|
242
|
+
it 'creates and attaches an elastic IP' do
|
243
|
+
expect(ec2).to receive_message_chain(:elastic_ips, :create).with(
|
243
244
|
vpc: true).and_return(elastic_ip)
|
244
245
|
|
245
|
-
|
246
|
+
expect(instance).to receive(:associate_elastic_ip).with(elastic_ip)
|
246
247
|
|
247
|
-
|
248
|
+
ami_manager.deploy(ami_file_path: ami_file_path, vm_config: vm_config)
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
context 'vm configuration contains an elastic IP' do
|
253
|
+
let(:vm_config) do
|
254
|
+
{
|
255
|
+
vm_name: 'some-vm-name',
|
256
|
+
vm_ip_address: 'some-ip-address'
|
257
|
+
}
|
258
|
+
end
|
259
|
+
|
260
|
+
it 'attaches the provided ip address to the VM' do
|
261
|
+
expect(AWS::EC2::ElasticIp).to receive(:new).and_return(elastic_ip)
|
262
|
+
expect(instance).to receive(:associate_elastic_ip).with(elastic_ip)
|
263
|
+
|
264
|
+
ami_manager.deploy(ami_file_path: ami_file_path, vm_config: vm_config)
|
265
|
+
end
|
248
266
|
end
|
249
267
|
|
250
268
|
it 'tags the instance with a name' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vm_shepherd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ops Manager Team
|
@@ -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.
|
198
|
+
rubygems_version: 2.4.5
|
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.
|