vm_shepherd 1.3.1 → 1.3.2
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/shepherd.rb +11 -2
- data/lib/vm_shepherd/version.rb +1 -1
- data/spec/fixtures/shepherd/aws-no-elb.yml +19 -0
- data/spec/vm_shepherd/shepherd_spec.rb +120 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0264092014869cdb1aca61d659d9838c50e239e5
|
4
|
+
data.tar.gz: 77f1ca1d5c5d7d07a6e5aca5325d807c8ba7cc74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0c84fd67b03781fe92547580a1b4b4fadf8b042df347010489c294620050756e2048e962c26c170212d6845fdf0734d39e0e194d803810c9eeb95bfcad25621
|
7
|
+
data.tar.gz: effff40c94b612051a6942de07e319bb373dabf816c40de9bb6e4ef96f94ece8443932f9cdb7f6f320d531d5047a0ae26e615daef407533d6ce281a28cbaae57
|
data/lib/vm_shepherd/shepherd.rb
CHANGED
@@ -203,13 +203,22 @@ module VmShepherd
|
|
203
203
|
json_file: settings.vm_shepherd.env_config.json_file,
|
204
204
|
parameters: settings.vm_shepherd.env_config.parameters_as_a_hash,
|
205
205
|
outputs: settings.vm_shepherd.env_config.outputs.to_h,
|
206
|
+
}.merge(ami_elb_config)
|
207
|
+
)
|
208
|
+
end
|
209
|
+
|
210
|
+
def ami_elb_config
|
211
|
+
if settings.vm_shepherd.env_config.elb
|
212
|
+
{
|
206
213
|
elb: {
|
207
214
|
name: settings.vm_shepherd.env_config.elb.name,
|
208
215
|
port_mappings: settings.vm_shepherd.env_config.elb.port_mappings,
|
209
216
|
stack_output_keys: settings.vm_shepherd.env_config.elb.stack_output_keys.to_h,
|
210
|
-
}
|
217
|
+
}
|
211
218
|
}
|
212
|
-
|
219
|
+
else
|
220
|
+
{}
|
221
|
+
end
|
213
222
|
end
|
214
223
|
|
215
224
|
def openstack_vm_manager(vm_shepherd_config)
|
data/lib/vm_shepherd/version.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
iaas_type: aws
|
2
|
+
|
3
|
+
vm_shepherd:
|
4
|
+
env_config:
|
5
|
+
stack_name: aws-stack-name
|
6
|
+
aws_access_key: aws-access-key
|
7
|
+
aws_secret_key: aws-secret-key
|
8
|
+
json_file: cloudformation.json
|
9
|
+
parameters:
|
10
|
+
key_pair_name: key_pair_name
|
11
|
+
outputs:
|
12
|
+
ssh_key_name: ssh-key-name
|
13
|
+
security_group: security-group-id
|
14
|
+
public_subnet_id: public-subnet-id
|
15
|
+
private_subnet_id: private-subnet-id
|
16
|
+
s3_bucket_name: bucket-name
|
17
|
+
vm_configs:
|
18
|
+
- vm_name: vm-name
|
19
|
+
- vm_name: vm-name-2
|
@@ -187,6 +187,37 @@ module VmShepherd
|
|
187
187
|
it 'fails if improper paths are given' do
|
188
188
|
expect { manager.deploy(paths: ['FIRST_FAKE_PATH']) }.to raise_error(ArgumentError)
|
189
189
|
end
|
190
|
+
|
191
|
+
context 'when there is no ELB configuration' do
|
192
|
+
let(:settings_fixture_name) { 'aws-no-elb.yml' }
|
193
|
+
|
194
|
+
let(:aws_env_config) do
|
195
|
+
{
|
196
|
+
stack_name: 'aws-stack-name',
|
197
|
+
aws_access_key: 'aws-access-key',
|
198
|
+
aws_secret_key: 'aws-secret-key',
|
199
|
+
json_file: 'cloudformation.json',
|
200
|
+
parameters: {
|
201
|
+
'key_pair_name' => 'key_pair_name'
|
202
|
+
},
|
203
|
+
outputs: {
|
204
|
+
ssh_key_name: 'ssh-key-name',
|
205
|
+
security_group: 'security-group-id',
|
206
|
+
public_subnet_id: 'public-subnet-id',
|
207
|
+
private_subnet_id: 'private-subnet-id',
|
208
|
+
s3_bucket_name: 'bucket-name',
|
209
|
+
},
|
210
|
+
}
|
211
|
+
end
|
212
|
+
|
213
|
+
it 'uses AwsManager to launch a VM' do
|
214
|
+
expect(AwsManager).to receive(:new).with(aws_env_config).and_return(aws_manager)
|
215
|
+
expect(aws_manager).to receive(:deploy).with(ami_file_path: first_ami_file_path, vm_config: first_aws_options)
|
216
|
+
expect(aws_manager).to receive(:deploy).with(ami_file_path: last_ami_file_path, vm_config: last_aws_options)
|
217
|
+
|
218
|
+
manager.deploy(paths: [first_ami_file_path, last_ami_file_path])
|
219
|
+
end
|
220
|
+
end
|
190
221
|
end
|
191
222
|
|
192
223
|
context 'with OpenStack settings' do
|
@@ -348,6 +379,37 @@ module VmShepherd
|
|
348
379
|
|
349
380
|
manager.destroy
|
350
381
|
end
|
382
|
+
|
383
|
+
context 'when there is no ELB configuration' do
|
384
|
+
let(:settings_fixture_name) { 'aws-no-elb.yml' }
|
385
|
+
|
386
|
+
let(:aws_env_config) do
|
387
|
+
{
|
388
|
+
stack_name: 'aws-stack-name',
|
389
|
+
aws_access_key: 'aws-access-key',
|
390
|
+
aws_secret_key: 'aws-secret-key',
|
391
|
+
json_file: 'cloudformation.json',
|
392
|
+
parameters: {
|
393
|
+
'key_pair_name' => 'key_pair_name'
|
394
|
+
},
|
395
|
+
outputs: {
|
396
|
+
ssh_key_name: 'ssh-key-name',
|
397
|
+
security_group: 'security-group-id',
|
398
|
+
public_subnet_id: 'public-subnet-id',
|
399
|
+
private_subnet_id: 'private-subnet-id',
|
400
|
+
s3_bucket_name: 'bucket-name',
|
401
|
+
},
|
402
|
+
}
|
403
|
+
end
|
404
|
+
|
405
|
+
it 'uses AwsManager to destroy a VM' do
|
406
|
+
expect(AwsManager).to receive(:new).with(aws_env_config).and_return(aws_manager)
|
407
|
+
expect(aws_manager).to receive(:destroy).with(first_ami_options)
|
408
|
+
expect(aws_manager).to receive(:destroy).with(last_ami_options)
|
409
|
+
|
410
|
+
manager.destroy
|
411
|
+
end
|
412
|
+
end
|
351
413
|
end
|
352
414
|
|
353
415
|
context 'when IAAS is Openstack' do
|
@@ -513,6 +575,35 @@ module VmShepherd
|
|
513
575
|
expect(aws_manager).to receive(:clean_environment)
|
514
576
|
manager.clean_environment
|
515
577
|
end
|
578
|
+
|
579
|
+
context 'when there is no ELB configuration' do
|
580
|
+
let(:settings_fixture_name) { 'aws-no-elb.yml' }
|
581
|
+
|
582
|
+
let(:aws_env_config) do
|
583
|
+
{
|
584
|
+
stack_name: 'aws-stack-name',
|
585
|
+
aws_access_key: 'aws-access-key',
|
586
|
+
aws_secret_key: 'aws-secret-key',
|
587
|
+
json_file: 'cloudformation.json',
|
588
|
+
parameters: {
|
589
|
+
'key_pair_name' => 'key_pair_name'
|
590
|
+
},
|
591
|
+
outputs: {
|
592
|
+
ssh_key_name: 'ssh-key-name',
|
593
|
+
security_group: 'security-group-id',
|
594
|
+
public_subnet_id: 'public-subnet-id',
|
595
|
+
private_subnet_id: 'private-subnet-id',
|
596
|
+
s3_bucket_name: 'bucket-name',
|
597
|
+
},
|
598
|
+
}
|
599
|
+
end
|
600
|
+
|
601
|
+
it 'uses AwsManager to destroy a VM' do
|
602
|
+
expect(AwsManager).to receive(:new).with(aws_env_config).and_return(aws_manager)
|
603
|
+
expect(aws_manager).to receive(:clean_environment)
|
604
|
+
manager.clean_environment
|
605
|
+
end
|
606
|
+
end
|
516
607
|
end
|
517
608
|
|
518
609
|
context 'when IAAS is Openstack' do
|
@@ -565,6 +656,35 @@ module VmShepherd
|
|
565
656
|
expect(ams_manager).to receive(:prepare_environment).with('cloudformation.json')
|
566
657
|
manager.prepare_environment
|
567
658
|
end
|
659
|
+
|
660
|
+
context 'when there is no ELB configuration' do
|
661
|
+
let(:settings_fixture_name) { 'aws-no-elb.yml' }
|
662
|
+
|
663
|
+
let(:aws_env_config) do
|
664
|
+
{
|
665
|
+
stack_name: 'aws-stack-name',
|
666
|
+
aws_access_key: 'aws-access-key',
|
667
|
+
aws_secret_key: 'aws-secret-key',
|
668
|
+
json_file: 'cloudformation.json',
|
669
|
+
parameters: {
|
670
|
+
'key_pair_name' => 'key_pair_name'
|
671
|
+
},
|
672
|
+
outputs: {
|
673
|
+
ssh_key_name: 'ssh-key-name',
|
674
|
+
security_group: 'security-group-id',
|
675
|
+
public_subnet_id: 'public-subnet-id',
|
676
|
+
private_subnet_id: 'private-subnet-id',
|
677
|
+
s3_bucket_name: 'bucket-name',
|
678
|
+
},
|
679
|
+
}
|
680
|
+
end
|
681
|
+
|
682
|
+
it 'uses AwsManager to create an environment' do
|
683
|
+
expect(AwsManager).to receive(:new).with(aws_env_config).and_return(ams_manager)
|
684
|
+
expect(ams_manager).to receive(:prepare_environment).with('cloudformation.json')
|
685
|
+
manager.prepare_environment
|
686
|
+
end
|
687
|
+
end
|
568
688
|
end
|
569
689
|
|
570
690
|
context 'when IAAS is vcloud' do
|
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.3.
|
4
|
+
version: 1.3.2
|
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-
|
11
|
+
date: 2015-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-v1
|
@@ -161,6 +161,7 @@ files:
|
|
161
161
|
- lib/vm_shepherd/version.rb
|
162
162
|
- lib/vm_shepherd/vsphere_manager.rb
|
163
163
|
- spec/fixtures/ova_manager/foo.ova
|
164
|
+
- spec/fixtures/shepherd/aws-no-elb.yml
|
164
165
|
- spec/fixtures/shepherd/aws.yml
|
165
166
|
- spec/fixtures/shepherd/openstack.yml
|
166
167
|
- spec/fixtures/shepherd/unknown.yml
|
@@ -200,6 +201,7 @@ specification_version: 4
|
|
200
201
|
summary: A tool for booting and tearing down Ops Manager VMs on various Infrastructures.
|
201
202
|
test_files:
|
202
203
|
- spec/fixtures/ova_manager/foo.ova
|
204
|
+
- spec/fixtures/shepherd/aws-no-elb.yml
|
203
205
|
- spec/fixtures/shepherd/aws.yml
|
204
206
|
- spec/fixtures/shepherd/openstack.yml
|
205
207
|
- spec/fixtures/shepherd/unknown.yml
|