vm_shepherd 1.12.7 → 2.0.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: 112c952184f763a10b6587d190b22fc09510f5e9
4
- data.tar.gz: 964df991586ad1a54f474195d9674f11e8ee681e
3
+ metadata.gz: 7ee2d52da3a902973a504843ace3b5e3ba0fed26
4
+ data.tar.gz: ce189c0987c686de0d6b923356d1b315dc14551a
5
5
  SHA512:
6
- metadata.gz: a043d01896df947cbed3989fae19a60a2d4c0b8b12ef1e4db51338bb2aba202e1ef12e660b8090d9ab73f513a4868d78a37c5eefac1448a9e8ddfa14a19edf5c
7
- data.tar.gz: 4e493456e16f1531d40635e38ef8a967ddb9137c3a97a6be993c46be22076cbcc834fd69bfbf72147ee63c43df916be7a8469bd5c4e89f61e577c559967fc729
6
+ metadata.gz: 45b5e0127208360ed18d086bfe233433bcad2c2dd80308cce95b9500ce6f34b9bbc37ea01be4cf90b4c65c8ebe8368b9cc5d632c2cc68ad541c6051bbc231887
7
+ data.tar.gz: b883adadd20c3441b98cf0873bbb6060df5093725dcb572ad6c0ea1022bc1dc6f6b6adf86fdeddf165158cf8ad9867f777a94109aa2b906a9771f5b936ca3b3a
@@ -1 +1 @@
1
- 2.2
1
+ 2.3.0
@@ -1,3 +1 @@
1
1
  language: ruby
2
- before_install:
3
- - gem install bundler -v '~> 1.9'
data/Rakefile CHANGED
@@ -1,6 +1,12 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
3
4
 
4
5
  RSpec::Core::RakeTask.new(:spec)
5
6
 
6
- task default: [:spec]
7
+ RuboCop::RakeTask.new(:rubocop) do |t|
8
+ t.options << '--lint'
9
+ t.options << '--display-cop-names'
10
+ end
11
+
12
+ task default: [:rubocop, :spec]
@@ -4,28 +4,29 @@ module VmShepherd
4
4
  end
5
5
 
6
6
  def initialize(settings:)
7
- @settings = settings
7
+ @iaas_type = settings.dig('iaas_type')
8
+ @configs = settings.dig('vm_shepherd', 'vm_configs') || []
9
+ @env_config = settings.dig('vm_shepherd', 'env_config')
8
10
  end
9
11
 
10
12
  def deploy(paths:)
11
- unless valid_iaas_types.include?(settings.iaas_type)
12
- fail(InvalidIaas, "Unknown IaaS type: #{settings.iaas_type.inspect}")
13
+ unless valid_iaas_types.include?(@iaas_type)
14
+ fail(InvalidIaas, "Unknown IaaS type: #{@iaas_type.inspect}")
13
15
  end
14
- configs = vm_shepherd_configs(settings)
15
- unless configs.size == paths.size
16
- fail(ArgumentError, "mismatch in available images to deploy (needed #{configs.size}, got #{paths.size})")
16
+ unless @configs.size == paths.size
17
+ fail(ArgumentError, "mismatch in available images to deploy (needed #{@configs.size}, got #{paths.size})")
17
18
  end
18
- configs.zip(paths).each do |vm_shepherd_config, path|
19
- case settings.iaas_type
19
+ @configs.zip(paths).each do |vm_shepherd_config, path|
20
+ case @iaas_type
20
21
  when VmShepherd::VCLOUD_IAAS_TYPE then
21
22
  VmShepherd::VcloudManager.new(
22
23
  {
23
- url: vm_shepherd_config.creds.url,
24
- organization: vm_shepherd_config.creds.organization,
25
- user: vm_shepherd_config.creds.user,
26
- password: vm_shepherd_config.creds.password,
24
+ url: vm_shepherd_config.dig('creds', 'url'),
25
+ organization: vm_shepherd_config.dig('creds', 'organization'),
26
+ user: vm_shepherd_config.dig('creds', 'user'),
27
+ password: vm_shepherd_config.dig('creds', 'password'),
27
28
  },
28
- vm_shepherd_config.vdc.name,
29
+ vm_shepherd_config.dig('vdc', 'name'),
29
30
  stdout_logger
30
31
  ).deploy(
31
32
  path,
@@ -33,30 +34,30 @@ module VmShepherd
33
34
  )
34
35
  when VmShepherd::VSPHERE_IAAS_TYPE then
35
36
  VmShepherd::VsphereManager.new(
36
- vm_shepherd_config.vcenter_creds.ip,
37
- vm_shepherd_config.vcenter_creds.username,
38
- vm_shepherd_config.vcenter_creds.password,
39
- vm_shepherd_config.vsphere.datacenter,
37
+ vm_shepherd_config.dig('vcenter_creds', 'ip'),
38
+ vm_shepherd_config.dig('vcenter_creds', 'username'),
39
+ vm_shepherd_config.dig('vcenter_creds', 'password'),
40
+ vm_shepherd_config.dig('vsphere', 'datacenter'),
40
41
  stdout_logger,
41
42
  ).deploy(
42
43
  path,
43
44
  {
44
- ip: vm_shepherd_config.vm.ip,
45
- gateway: vm_shepherd_config.vm.gateway,
46
- netmask: vm_shepherd_config.vm.netmask,
47
- dns: vm_shepherd_config.vm.dns,
48
- ntp_servers: vm_shepherd_config.vm.ntp_servers,
45
+ ip: vm_shepherd_config.dig('vm', 'ip'),
46
+ gateway: vm_shepherd_config.dig('vm', 'gateway'),
47
+ netmask: vm_shepherd_config.dig('vm', 'netmask'),
48
+ dns: vm_shepherd_config.dig('vm', 'dns'),
49
+ ntp_servers: vm_shepherd_config.dig('vm', 'ntp_servers'),
49
50
  },
50
51
  {
51
- cluster: vm_shepherd_config.vsphere.cluster,
52
- resource_pool: vm_shepherd_config.vsphere.resource_pool,
53
- datastore: vm_shepherd_config.vsphere.datastore,
54
- network: vm_shepherd_config.vsphere.network,
55
- folder: vm_shepherd_config.vsphere.folder,
52
+ cluster: vm_shepherd_config.dig('vsphere', 'cluster'),
53
+ resource_pool: vm_shepherd_config.dig('vsphere', 'resource_pool'),
54
+ datastore: vm_shepherd_config.dig('vsphere', 'datastore'),
55
+ network: vm_shepherd_config.dig('vsphere', 'network'),
56
+ folder: vm_shepherd_config.dig('vsphere', 'folder'),
56
57
  }
57
58
  )
58
59
  when VmShepherd::AWS_IAAS_TYPE then
59
- ami_manager.deploy(ami_file_path: path, vm_config: vm_shepherd_config.to_h)
60
+ ami_manager.deploy(ami_file_path: path, vm_config: vm_shepherd_config)
60
61
  when VmShepherd::OPENSTACK_IAAS_TYPE then
61
62
  openstack_vm_manager(vm_shepherd_config).deploy(path, openstack_vm_options(vm_shepherd_config))
62
63
  end
@@ -64,69 +65,69 @@ module VmShepherd
64
65
  end
65
66
 
66
67
  def prepare_environment
67
- unless valid_iaas_types.include?(settings.iaas_type)
68
- fail(InvalidIaas, "Unknown IaaS type: #{settings.iaas_type.inspect}")
68
+ unless valid_iaas_types.include?(@iaas_type)
69
+ fail(InvalidIaas, "Unknown IaaS type: #{@iaas_type.inspect}")
69
70
  end
70
- case settings.iaas_type
71
+ case @iaas_type
71
72
  when VmShepherd::VCLOUD_IAAS_TYPE then
72
- vm_shepherd_configs(settings).each do |vm_shepherd_config|
73
+ @configs.each do |vm_shepherd_config|
73
74
  VmShepherd::VcloudManager.new(
74
75
  {
75
- url: vm_shepherd_config.creds.url,
76
- organization: vm_shepherd_config.creds.organization,
77
- user: vm_shepherd_config.creds.user,
78
- password: vm_shepherd_config.creds.password,
76
+ url: vm_shepherd_config.dig('creds', 'url'),
77
+ organization: vm_shepherd_config.dig('creds', 'organization'),
78
+ user: vm_shepherd_config.dig('creds', 'user'),
79
+ password: vm_shepherd_config.dig('creds', 'password'),
79
80
  },
80
- vm_shepherd_config.vdc.name,
81
+ vm_shepherd_config.dig('vdc', 'name'),
81
82
  stdout_logger
82
83
  ).prepare_environment
83
84
  end
84
85
  when VmShepherd::VSPHERE_IAAS_TYPE then
85
- vm_shepherd_configs(settings).each do |vm_shepherd_config|
86
+ @configs.each do |vm_shepherd_config|
86
87
  VmShepherd::VsphereManager.new(
87
- vm_shepherd_config.vcenter_creds.ip,
88
- vm_shepherd_config.vcenter_creds.username,
89
- vm_shepherd_config.vcenter_creds.password,
90
- vm_shepherd_config.vsphere.datacenter,
88
+ vm_shepherd_config.dig('vcenter_creds', 'ip'),
89
+ vm_shepherd_config.dig('vcenter_creds', 'username'),
90
+ vm_shepherd_config.dig('vcenter_creds', 'password'),
91
+ vm_shepherd_config.dig('vsphere', 'datacenter'),
91
92
  stdout_logger,
92
93
  ).prepare_environment
93
94
  end
94
95
  when VmShepherd::AWS_IAAS_TYPE then
95
- ami_manager.prepare_environment(settings.vm_shepherd.env_config.json_file)
96
+ ami_manager.prepare_environment(@env_config.dig('json_file'))
96
97
  when VmShepherd::OPENSTACK_IAAS_TYPE then
97
- vm_shepherd_configs(settings).each do |vm_shepherd_config|
98
+ @configs.each do |vm_shepherd_config|
98
99
  openstack_vm_manager(vm_shepherd_config).prepare_environment
99
100
  end
100
101
  end
101
102
  end
102
103
 
103
104
  def destroy
104
- unless valid_iaas_types.include?(settings.iaas_type)
105
- fail(InvalidIaas, "Unknown IaaS type: #{settings.iaas_type.inspect}")
105
+ unless valid_iaas_types.include?(@iaas_type)
106
+ fail(InvalidIaas, "Unknown IaaS type: #{@iaas_type.inspect}")
106
107
  end
107
- vm_shepherd_configs(settings).each do |vm_shepherd_config|
108
- case settings.iaas_type
108
+ @configs.each do |vm_shepherd_config|
109
+ case @iaas_type
109
110
  when VmShepherd::VCLOUD_IAAS_TYPE then
110
111
  VmShepherd::VcloudManager.new(
111
112
  {
112
- url: vm_shepherd_config.creds.url,
113
- organization: vm_shepherd_config.creds.organization,
114
- user: vm_shepherd_config.creds.user,
115
- password: vm_shepherd_config.creds.password,
113
+ url: vm_shepherd_config.dig('creds', 'url'),
114
+ organization: vm_shepherd_config.dig('creds', 'organization'),
115
+ user: vm_shepherd_config.dig('creds', 'user'),
116
+ password: vm_shepherd_config.dig('creds', 'password'),
116
117
  },
117
- vm_shepherd_config.vdc.name,
118
+ vm_shepherd_config.dig('vdc', 'name'),
118
119
  stdout_logger
119
- ).destroy([vm_shepherd_config.vapp.ops_manager_name], vm_shepherd_config.vdc.catalog)
120
+ ).destroy([vm_shepherd_config.dig('vapp', 'ops_manager_name')], vm_shepherd_config.dig('vdc', 'catalog'))
120
121
  when VmShepherd::VSPHERE_IAAS_TYPE then
121
122
  VmShepherd::VsphereManager.new(
122
- vm_shepherd_config.vcenter_creds.ip,
123
- vm_shepherd_config.vcenter_creds.username,
124
- vm_shepherd_config.vcenter_creds.password,
125
- vm_shepherd_config.vsphere.datacenter,
123
+ vm_shepherd_config.dig('vcenter_creds', 'ip'),
124
+ vm_shepherd_config.dig('vcenter_creds', 'username'),
125
+ vm_shepherd_config.dig('vcenter_creds', 'password'),
126
+ vm_shepherd_config.dig('vsphere', 'datacenter'),
126
127
  stdout_logger,
127
- ).destroy(vm_shepherd_config.vm.ip, vm_shepherd_config.vsphere.resource_pool)
128
+ ).destroy(vm_shepherd_config.dig('vm', 'ip'), vm_shepherd_config.dig('vsphere', 'resource_pool'))
128
129
  when VmShepherd::AWS_IAAS_TYPE then
129
- ami_manager.destroy(vm_shepherd_config.to_h)
130
+ ami_manager.destroy(vm_shepherd_config)
130
131
  when VmShepherd::OPENSTACK_IAAS_TYPE then
131
132
  openstack_vm_manager(vm_shepherd_config).destroy(openstack_vm_options(vm_shepherd_config))
132
133
  end
@@ -134,41 +135,41 @@ module VmShepherd
134
135
  end
135
136
 
136
137
  def clean_environment
137
- unless valid_iaas_types.include?(settings.iaas_type)
138
- fail(InvalidIaas, "Unknown IaaS type: #{settings.iaas_type.inspect}")
138
+ unless valid_iaas_types.include?(@iaas_type)
139
+ fail(InvalidIaas, "Unknown IaaS type: #{@iaas_type.inspect}")
139
140
  end
140
- case settings.iaas_type
141
+ case @iaas_type
141
142
  when VmShepherd::VCLOUD_IAAS_TYPE then
142
- vm_shepherd_configs(settings).each do |vm_shepherd_config|
143
+ @configs.each do |vm_shepherd_config|
143
144
  VmShepherd::VcloudManager.new(
144
145
  {
145
- url: vm_shepherd_config.creds.url,
146
- organization: vm_shepherd_config.creds.organization,
147
- user: vm_shepherd_config.creds.user,
148
- password: vm_shepherd_config.creds.password,
146
+ url: vm_shepherd_config.dig('creds', 'url'),
147
+ organization: vm_shepherd_config.dig('creds', 'organization'),
148
+ user: vm_shepherd_config.dig('creds', 'user'),
149
+ password: vm_shepherd_config.dig('creds', 'password'),
149
150
  },
150
- vm_shepherd_config.vdc.name,
151
+ vm_shepherd_config.dig('vdc', 'name'),
151
152
  stdout_logger,
152
- ).clean_environment(vm_shepherd_config.vapp.product_names || [], vm_shepherd_config.vapp.product_catalog)
153
+ ).clean_environment(vm_shepherd_config.dig('vapp', 'product_names')|| [], vm_shepherd_config.dig('vapp', 'product_catalog'))
153
154
  end
154
155
  when VmShepherd::VSPHERE_IAAS_TYPE then
155
- vm_shepherd_configs(settings).each do |vm_shepherd_config|
156
+ @configs.each do |vm_shepherd_config|
156
157
  VmShepherd::VsphereManager.new(
157
- vm_shepherd_config.vcenter_creds.ip,
158
- vm_shepherd_config.vcenter_creds.username,
159
- vm_shepherd_config.vcenter_creds.password,
160
- vm_shepherd_config.cleanup.datacenter,
158
+ vm_shepherd_config.dig('vcenter_creds', 'ip'),
159
+ vm_shepherd_config.dig('vcenter_creds', 'username'),
160
+ vm_shepherd_config.dig('vcenter_creds', 'password'),
161
+ vm_shepherd_config.dig('cleanup', 'datacenter'),
161
162
  stdout_logger,
162
163
  ).clean_environment(
163
- datacenter_folders_to_clean: vm_shepherd_config.cleanup.datacenter_folders_to_clean,
164
- datastores: vm_shepherd_config.cleanup.datastores,
165
- datastore_folders_to_clean: vm_shepherd_config.cleanup.datastore_folders_to_clean,
164
+ datacenter_folders_to_clean: vm_shepherd_config.dig('cleanup', 'datacenter_folders_to_clean'),
165
+ datastores: vm_shepherd_config.dig('cleanup', 'datastores'),
166
+ datastore_folders_to_clean: vm_shepherd_config.dig('cleanup', 'datastore_folders_to_clean'),
166
167
  )
167
168
  end
168
169
  when VmShepherd::AWS_IAAS_TYPE then
169
170
  ami_manager.clean_environment
170
171
  when VmShepherd::OPENSTACK_IAAS_TYPE then
171
- vm_shepherd_configs(settings).each do |vm_shepherd_config|
172
+ @configs.each do |vm_shepherd_config|
172
173
  openstack_vm_manager(vm_shepherd_config).clean_environment
173
174
  end
174
175
  end
@@ -176,23 +177,21 @@ module VmShepherd
176
177
 
177
178
  private
178
179
 
179
- attr_reader :settings
180
180
 
181
181
  def stdout_logger
182
182
  Logger.new(STDOUT)
183
183
  end
184
184
 
185
185
  def vcloud_deploy_options(vm_shepherd_config)
186
- vm = vm_shepherd_config.vapp
187
186
  VmShepherd::Vcloud::VappConfig.new(
188
- name: vm.ops_manager_name,
189
- ip: vm.ip,
190
- gateway: vm.gateway,
191
- netmask: vm.netmask,
192
- dns: vm.dns,
193
- ntp: vm.ntp,
194
- catalog: vm_shepherd_config.vdc.catalog,
195
- network: vm_shepherd_config.vdc.network,
187
+ name: vm_shepherd_config.dig('vapp', 'ops_manager_name'),
188
+ ip: vm_shepherd_config.dig('vapp', 'ip'),
189
+ gateway: vm_shepherd_config.dig('vapp', 'gateway'),
190
+ netmask: vm_shepherd_config.dig('vapp', 'netmask'),
191
+ dns: vm_shepherd_config.dig('vapp', 'dns'),
192
+ ntp: vm_shepherd_config.dig('vapp', 'ntp'),
193
+ catalog: vm_shepherd_config.dig('vdc', 'catalog'),
194
+ network: vm_shepherd_config.dig('vdc', 'network'),
196
195
  )
197
196
  end
198
197
 
@@ -200,26 +199,26 @@ module VmShepherd
200
199
  @ami_manager ||=
201
200
  VmShepherd::AwsManager.new(
202
201
  env_config: {
203
- stack_name: settings.vm_shepherd.env_config.stack_name,
204
- aws_access_key: settings.vm_shepherd.env_config.aws_access_key,
205
- aws_secret_key: settings.vm_shepherd.env_config.aws_secret_key,
206
- region: settings.vm_shepherd.env_config.region,
207
- json_file: settings.vm_shepherd.env_config.json_file,
208
- parameters: settings.vm_shepherd.env_config.parameters_as_a_hash,
209
- outputs: settings.vm_shepherd.env_config.outputs.to_h,
202
+ 'stack_name' => @env_config.dig('stack_name'),
203
+ 'aws_access_key' => @env_config.dig('aws_access_key'),
204
+ 'aws_secret_key' => @env_config.dig('aws_secret_key'),
205
+ 'region' => @env_config.dig('region'),
206
+ 'json_file' => @env_config.dig('json_file'),
207
+ 'parameters' => @env_config.dig('parameters'),
208
+ 'outputs' => @env_config.dig('outputs'),
210
209
  }.merge(ami_elb_config),
211
210
  logger: stdout_logger,
212
211
  )
213
212
  end
214
213
 
215
214
  def ami_elb_config
216
- if settings.vm_shepherd.env_config.elbs
215
+ if @env_config.dig('elbs')
217
216
  {
218
- elbs: settings.vm_shepherd.env_config.elbs.map do |elb|
217
+ 'elbs' => @env_config.dig('elbs').map do |elb|
219
218
  {
220
- name: elb.name,
221
- port_mappings: elb.port_mappings,
222
- stack_output_keys: elb.stack_output_keys.to_h,
219
+ 'name' => elb.dig('name'),
220
+ 'port_mappings' => elb.dig('port_mappings'),
221
+ 'stack_output_keys' => elb.dig('stack_output_keys'),
223
222
  }
224
223
  end
225
224
  }
@@ -230,29 +229,25 @@ module VmShepherd
230
229
 
231
230
  def openstack_vm_manager(vm_shepherd_config)
232
231
  OpenstackManager.new(
233
- auth_url: vm_shepherd_config.creds.auth_url,
234
- username: vm_shepherd_config.creds.username,
235
- api_key: vm_shepherd_config.creds.api_key,
236
- tenant: vm_shepherd_config.creds.tenant,
232
+ auth_url: vm_shepherd_config.dig('creds', 'auth_url'),
233
+ username: vm_shepherd_config.dig('creds', 'username'),
234
+ api_key: vm_shepherd_config.dig('creds', 'api_key'),
235
+ tenant: vm_shepherd_config.dig('creds', 'tenant'),
237
236
  )
238
237
  end
239
238
 
240
239
  def openstack_vm_options(vm_shepherd_config)
241
240
  {
242
- name: vm_shepherd_config.vm.name,
243
- flavor_name: vm_shepherd_config.vm.flavor_name,
244
- network_name: vm_shepherd_config.vm.network_name,
245
- key_name: vm_shepherd_config.vm.key_name,
246
- security_group_names: vm_shepherd_config.vm.security_group_names,
247
- public_ip: vm_shepherd_config.vm.public_ip,
248
- private_ip: vm_shepherd_config.vm.private_ip,
241
+ name: vm_shepherd_config.dig('vm', 'name'),
242
+ flavor_name: vm_shepherd_config.dig('vm', 'flavor_name'),
243
+ network_name: vm_shepherd_config.dig('vm', 'network_name'),
244
+ key_name: vm_shepherd_config.dig('vm', 'key_name'),
245
+ security_group_names: vm_shepherd_config.dig('vm', 'security_group_names'),
246
+ public_ip: vm_shepherd_config.dig('vm', 'public_ip'),
247
+ private_ip: vm_shepherd_config.dig('vm', 'private_ip'),
249
248
  }
250
249
  end
251
250
 
252
- def vm_shepherd_configs(settings)
253
- settings.vm_shepherd.vm_configs || []
254
- end
255
-
256
251
  def valid_iaas_types
257
252
  [
258
253
  VmShepherd::VCLOUD_IAAS_TYPE,
@@ -1,10 +1,6 @@
1
- require 'vm_shepherd/retry_helper'
2
-
3
1
  module VmShepherd
4
2
  module Vcloud
5
3
  class Deployer
6
- extend RetryHelper
7
-
8
4
  def self.deploy_and_power_on_vapp(client:, ovf_dir:, vapp_config:, vdc_name:)
9
5
  catalog = client.create_catalog(vapp_config.catalog)
10
6
 
@@ -16,10 +12,7 @@ module VmShepherd
16
12
  vapp = catalog.instantiate_vapp_template(vapp_config.name, vdc_name, vapp_config.name, nil, nil, network_config)
17
13
 
18
14
  # reconfigure vm
19
- vm = retry_until(retry_limit: 10, retry_interval: 10) do
20
- vapp.vms.first
21
- end
22
-
15
+ vm = vapp.find_vm_by_name(vapp_config.name)
23
16
  vm.product_section_properties = vapp_config.build_properties
24
17
 
25
18
  # power on vapp
@@ -1,3 +1,3 @@
1
1
  module VmShepherd
2
- VERSION = '1.12.7'.freeze
2
+ VERSION = '2.0.0'.freeze
3
3
  end
@@ -1,50 +1,47 @@
1
1
  require 'vm_shepherd'
2
- require 'recursive_open_struct'
3
2
 
4
3
  module VmShepherd
5
4
  RSpec.describe Shepherd do
6
5
  subject(:manager) { Shepherd.new(settings: settings) }
7
- let(:first_config) { settings.vm_shepherd.vm_configs.first }
8
- let(:last_config) { settings.vm_shepherd.vm_configs.last }
9
- let(:settings) do
10
- RecursiveOpenStruct.new(YAML.load_file(File.join(SPEC_ROOT, 'fixtures', 'shepherd', settings_fixture_name)), recurse_over_arrays: true)
11
- end
6
+ let(:first_config) { settings.dig('vm_shepherd', 'vm_configs').first }
7
+ let(:last_config) { settings.dig('vm_shepherd', 'vm_configs').last }
8
+ let(:settings) { YAML.load_file(File.join(SPEC_ROOT, 'fixtures', 'shepherd', settings_fixture_name)) }
12
9
  let(:aws_env_config) do
13
10
  {
14
- stack_name: 'aws-stack-name',
15
- aws_access_key: 'aws-access-key',
16
- aws_secret_key: 'aws-secret-key',
17
- region: 'aws-region',
18
- json_file: 'cloudformation.json',
19
- parameters: {
11
+ 'stack_name' => 'aws-stack-name',
12
+ 'aws_access_key' => 'aws-access-key',
13
+ 'aws_secret_key' => 'aws-secret-key',
14
+ 'region' => 'aws-region',
15
+ 'json_file' => 'cloudformation.json',
16
+ 'parameters' => {
20
17
  'key_pair_name' => 'key_pair_name'
21
18
  },
22
- outputs: {
23
- ssh_key_name: 'ssh-key-name',
24
- security_group: 'security-group-id',
25
- public_subnet_id: 'public-subnet-id',
26
- private_subnet_id: 'private-subnet-id',
27
- s3_bucket_name: 'bucket-name',
19
+ 'outputs' => {
20
+ 'ssh_key_name' => 'ssh-key-name',
21
+ 'security_group' => 'security-group-id',
22
+ 'public_subnet_id' => 'public-subnet-id',
23
+ 'private_subnet_id' => 'private-subnet-id',
24
+ 's3_bucket_name' => 'bucket-name',
28
25
  },
29
26
  }.merge(aws_elb_config)
30
27
  end
31
28
  let(:aws_elb_config) do
32
29
  {
33
- elbs: [
30
+ 'elbs' => [
34
31
  {
35
- name: 'elb-1-name',
36
- port_mappings: [[1111, 11]],
37
- stack_output_keys: {
38
- vpc_id: 'CloudFormationVpcIdOutputKey',
39
- subnet_id: 'CloudFormationSubnetIdOutputKey',
32
+ 'name' => 'elb-1-name',
33
+ 'port_mappings' => [[1111, 11]],
34
+ 'stack_output_keys' => {
35
+ 'vpc_id' => 'CloudFormationVpcIdOutputKey',
36
+ 'subnet_id' => 'CloudFormationSubnetIdOutputKey',
40
37
  },
41
38
  },
42
39
  {
43
- name: 'elb-2-name',
44
- port_mappings: [[2222, 22]],
45
- stack_output_keys: {
46
- vpc_id: 'CloudFormationVpcIdOutputKey',
47
- subnet_id: 'CloudFormationSubnetIdOutputKey',
40
+ 'name' => 'elb-2-name',
41
+ 'port_mappings' => [[2222, 22]],
42
+ 'stack_output_keys' => {
43
+ 'vpc_id' => 'CloudFormationVpcIdOutputKey',
44
+ 'subnet_id' => 'CloudFormationSubnetIdOutputKey',
48
45
  },
49
46
  }
50
47
  ],
@@ -59,56 +56,56 @@ module VmShepherd
59
56
 
60
57
  it 'uses VcloudManager to launch a vm' do
61
58
  expect(VcloudManager).to receive(:new).
62
- with(
63
- {
64
- url: first_config.creds.url,
65
- organization: first_config.creds.organization,
66
- user: first_config.creds.user,
67
- password: first_config.creds.password,
68
- },
69
- first_config.vdc.name,
70
- instance_of(Logger)
71
- ).and_return(first_vcloud_manager)
59
+ with(
60
+ {
61
+ url: first_config.dig('creds', 'url'),
62
+ organization: first_config.dig('creds', 'organization'),
63
+ user: first_config.dig('creds', 'user'),
64
+ password: first_config.dig('creds', 'password'),
65
+ },
66
+ first_config.dig('vdc', 'name'),
67
+ instance_of(Logger)
68
+ ).and_return(first_vcloud_manager)
72
69
 
73
70
  expect(VcloudManager).to receive(:new).
74
- with(
75
- {
76
- url: last_config.creds.url,
77
- organization: last_config.creds.organization,
78
- user: last_config.creds.user,
79
- password: last_config.creds.password,
80
- },
81
- last_config.vdc.name,
82
- instance_of(Logger)
83
- ).and_return(last_vcloud_manager)
71
+ with(
72
+ {
73
+ url: last_config.dig('creds', 'url'),
74
+ organization: last_config.dig('creds', 'organization'),
75
+ user: last_config.dig('creds', 'user'),
76
+ password: last_config.dig('creds', 'password'),
77
+ },
78
+ last_config.dig('vdc', 'name'),
79
+ instance_of(Logger)
80
+ ).and_return(last_vcloud_manager)
84
81
 
85
82
  expect(first_vcloud_manager).to receive(:deploy).with(
86
- 'FIRST_FAKE_PATH',
87
- Vcloud::VappConfig.new(
88
- name: first_config.vapp.ops_manager_name,
89
- ip: first_config.vapp.ip,
90
- gateway: first_config.vapp.gateway,
91
- netmask: first_config.vapp.netmask,
92
- dns: first_config.vapp.dns,
93
- ntp: first_config.vapp.ntp,
94
- catalog: first_config.vdc.catalog,
95
- network: first_config.vdc.network,
96
- )
83
+ 'FIRST_FAKE_PATH',
84
+ Vcloud::VappConfig.new(
85
+ name: first_config.dig('vapp', 'ops_manager_name'),
86
+ ip: first_config.dig('vapp', 'ip'),
87
+ gateway: first_config.dig('vapp', 'gateway'),
88
+ netmask: first_config.dig('vapp', 'netmask'),
89
+ dns: first_config.dig('vapp', 'dns'),
90
+ ntp: first_config.dig('vapp', 'ntp'),
91
+ catalog: first_config.dig('vdc', 'catalog'),
92
+ network: first_config.dig('vdc', 'network'),
97
93
  )
94
+ )
98
95
 
99
96
  expect(last_vcloud_manager).to receive(:deploy).with(
100
- 'LAST_FAKE_PATH',
101
- Vcloud::VappConfig.new(
102
- name: last_config.vapp.ops_manager_name,
103
- ip: last_config.vapp.ip,
104
- gateway: last_config.vapp.gateway,
105
- netmask: last_config.vapp.netmask,
106
- dns: last_config.vapp.dns,
107
- ntp: last_config.vapp.ntp,
108
- catalog: last_config.vdc.catalog,
109
- network: last_config.vdc.network,
110
- )
97
+ 'LAST_FAKE_PATH',
98
+ Vcloud::VappConfig.new(
99
+ name: last_config.dig('vapp', 'ops_manager_name'),
100
+ ip: last_config.dig('vapp', 'ip'),
101
+ gateway: last_config.dig('vapp', 'gateway'),
102
+ netmask: last_config.dig('vapp', 'netmask'),
103
+ dns: last_config.dig('vapp', 'dns'),
104
+ ntp: last_config.dig('vapp', 'ntp'),
105
+ catalog: last_config.dig('vdc', 'catalog'),
106
+ network: last_config.dig('vdc', 'network'),
111
107
  )
108
+ )
112
109
 
113
110
  manager.deploy(paths: ['FIRST_FAKE_PATH', 'LAST_FAKE_PATH'])
114
111
  end
@@ -125,56 +122,56 @@ module VmShepherd
125
122
 
126
123
  it 'uses VsphereManager to launch a vm' do
127
124
  expect(VsphereManager).to receive(:new).with(
128
- first_config.vcenter_creds.ip,
129
- first_config.vcenter_creds.username,
130
- first_config.vcenter_creds.password,
131
- first_config.vsphere.datacenter,
132
- instance_of(Logger),
133
- ).and_return(first_ova_manager)
125
+ first_config.dig('vcenter_creds', 'ip'),
126
+ first_config.dig('vcenter_creds', 'username'),
127
+ first_config.dig('vcenter_creds', 'password'),
128
+ first_config.dig('vsphere', 'datacenter'),
129
+ instance_of(Logger),
130
+ ).and_return(first_ova_manager)
134
131
 
135
132
  expect(VsphereManager).to receive(:new).with(
136
- last_config.vcenter_creds.ip,
137
- last_config.vcenter_creds.username,
138
- last_config.vcenter_creds.password,
139
- last_config.vsphere.datacenter,
140
- instance_of(Logger),
141
- ).and_return(last_ova_manager)
133
+ last_config.dig('vcenter_creds', 'ip'),
134
+ last_config.dig('vcenter_creds', 'username'),
135
+ last_config.dig('vcenter_creds', 'password'),
136
+ last_config.dig('vsphere', 'datacenter'),
137
+ instance_of(Logger),
138
+ ).and_return(last_ova_manager)
142
139
 
143
140
  expect(first_ova_manager).to receive(:deploy).with(
144
- 'FIRST_FAKE_PATH',
145
- {
146
- ip: first_config.vm.ip,
147
- gateway: first_config.vm.gateway,
148
- netmask: first_config.vm.netmask,
149
- dns: first_config.vm.dns,
150
- ntp_servers: first_config.vm.ntp_servers,
151
- },
152
- {
153
- cluster: first_config.vsphere.cluster,
154
- resource_pool: first_config.vsphere.resource_pool,
155
- datastore: first_config.vsphere.datastore,
156
- network: first_config.vsphere.network,
157
- folder: first_config.vsphere.folder,
158
- },
159
- )
141
+ 'FIRST_FAKE_PATH',
142
+ {
143
+ ip: first_config.dig('vm', 'ip'),
144
+ gateway: first_config.dig('vm', 'gateway'),
145
+ netmask: first_config.dig('vm', 'netmask'),
146
+ dns: first_config.dig('vm', 'dns'),
147
+ ntp_servers: first_config.dig('vm', 'ntp_servers'),
148
+ },
149
+ {
150
+ cluster: first_config.dig('vsphere', 'cluster'),
151
+ resource_pool: first_config.dig('vsphere', 'resource_pool'),
152
+ datastore: first_config.dig('vsphere', 'datastore'),
153
+ network: first_config.dig('vsphere', 'network'),
154
+ folder: first_config.dig('vsphere', 'folder'),
155
+ },
156
+ )
160
157
 
161
158
  expect(last_ova_manager).to receive(:deploy).with(
162
- 'LAST_FAKE_PATH',
163
- {
164
- ip: last_config.vm.ip,
165
- gateway: last_config.vm.gateway,
166
- netmask: last_config.vm.netmask,
167
- dns: last_config.vm.dns,
168
- ntp_servers: last_config.vm.ntp_servers,
169
- },
170
- {
171
- cluster: last_config.vsphere.cluster,
172
- resource_pool: last_config.vsphere.resource_pool,
173
- datastore: last_config.vsphere.datastore,
174
- network: last_config.vsphere.network,
175
- folder: last_config.vsphere.folder,
176
- },
177
- )
159
+ 'LAST_FAKE_PATH',
160
+ {
161
+ ip: last_config.dig('vm', 'ip'),
162
+ gateway: last_config.dig('vm', 'gateway'),
163
+ netmask: last_config.dig('vm', 'netmask'),
164
+ dns: last_config.dig('vm', 'dns'),
165
+ ntp_servers: last_config.dig('vm', 'ntp_servers'),
166
+ },
167
+ {
168
+ cluster: last_config.dig('vsphere', 'cluster'),
169
+ resource_pool: last_config.dig('vsphere', 'resource_pool'),
170
+ datastore: last_config.dig('vsphere', 'datastore'),
171
+ network: last_config.dig('vsphere', 'network'),
172
+ folder: last_config.dig('vsphere', 'folder'),
173
+ },
174
+ )
178
175
 
179
176
  manager.deploy(paths: ['FIRST_FAKE_PATH', 'LAST_FAKE_PATH'])
180
177
  end
@@ -189,8 +186,8 @@ module VmShepherd
189
186
  let(:aws_manager) { instance_double(AwsManager) }
190
187
  let(:first_ami_file_path) { 'PATH_TO_AMI_FILE' }
191
188
  let(:last_ami_file_path) { 'PATH_TO_AMI_FILE-2' }
192
- let(:first_aws_options) { {vm_name: 'vm-name'} }
193
- let(:last_aws_options) { {vm_name: 'vm-name-2'} }
189
+ let(:first_aws_options) { {'vm_name' => 'vm-name'} }
190
+ let(:last_aws_options) { {'vm_name' => 'vm-name-2'} }
194
191
 
195
192
  it 'uses AwsManager to launch a VM' do
196
193
  expect(AwsManager).to receive(:new).with(env_config: aws_env_config, logger: instance_of(Logger)).and_return(aws_manager)
@@ -303,36 +300,36 @@ module VmShepherd
303
300
 
304
301
  it 'uses VcloudManager to destroy a vm' do
305
302
  expect(VcloudManager).to receive(:new).with(
306
- {
307
- url: first_config.creds.url,
308
- organization: first_config.creds.organization,
309
- user: first_config.creds.user,
310
- password: first_config.creds.password,
311
- },
312
- first_config.vdc.name,
313
- instance_of(Logger)
314
- ).and_return(first_vcloud_manager)
303
+ {
304
+ url: first_config.dig('creds', 'url'),
305
+ organization: first_config.dig('creds', 'organization'),
306
+ user: first_config.dig('creds', 'user'),
307
+ password: first_config.dig('creds', 'password'),
308
+ },
309
+ first_config.dig('vdc', 'name'),
310
+ instance_of(Logger)
311
+ ).and_return(first_vcloud_manager)
315
312
 
316
313
  expect(first_vcloud_manager).to receive(:destroy).with(
317
- [first_config.vapp.ops_manager_name],
318
- first_config.vdc.catalog,
319
- )
314
+ [first_config.dig('vapp', 'ops_manager_name')],
315
+ first_config.dig('vdc', 'catalog'),
316
+ )
320
317
 
321
318
  expect(VcloudManager).to receive(:new).with(
322
- {
323
- url: last_config.creds.url,
324
- organization: last_config.creds.organization,
325
- user: last_config.creds.user,
326
- password: last_config.creds.password,
327
- },
328
- last_config.vdc.name,
329
- instance_of(Logger)
330
- ).and_return(last_vcloud_manager)
319
+ {
320
+ url: last_config.dig('creds', 'url'),
321
+ organization: last_config.dig('creds', 'organization'),
322
+ user: last_config.dig('creds', 'user'),
323
+ password: last_config.dig('creds', 'password'),
324
+ },
325
+ last_config.dig('vdc', 'name'),
326
+ instance_of(Logger)
327
+ ).and_return(last_vcloud_manager)
331
328
 
332
329
  expect(last_vcloud_manager).to receive(:destroy).with(
333
- [last_config.vapp.ops_manager_name],
334
- last_config.vdc.catalog,
335
- )
330
+ [last_config.dig('vapp', 'ops_manager_name')],
331
+ last_config.dig('vdc', 'catalog'),
332
+ )
336
333
 
337
334
  manager.destroy
338
335
  end
@@ -345,22 +342,22 @@ module VmShepherd
345
342
 
346
343
  it 'uses VsphereManager to destroy a vm' do
347
344
  expect(VsphereManager).to receive(:new).with(
348
- first_config.vcenter_creds.ip,
349
- first_config.vcenter_creds.username,
350
- first_config.vcenter_creds.password,
351
- first_config.vsphere.datacenter,
352
- instance_of(Logger),
353
- ).and_return(first_ova_manager)
354
- expect(first_ova_manager).to receive(:destroy).with(first_config.vm.ip, first_config.vsphere.resource_pool)
345
+ first_config.dig('vcenter_creds', 'ip'),
346
+ first_config.dig('vcenter_creds', 'username'),
347
+ first_config.dig('vcenter_creds', 'password'),
348
+ first_config.dig('vsphere', 'datacenter'),
349
+ instance_of(Logger),
350
+ ).and_return(first_ova_manager)
351
+ expect(first_ova_manager).to receive(:destroy).with(first_config.dig('vm', 'ip'), first_config.dig('vsphere', 'resource_pool'))
355
352
 
356
353
  expect(VsphereManager).to receive(:new).with(
357
- last_config.vcenter_creds.ip,
358
- last_config.vcenter_creds.username,
359
- last_config.vcenter_creds.password,
360
- last_config.vsphere.datacenter,
361
- instance_of(Logger),
362
- ).and_return(last_ova_manager)
363
- expect(last_ova_manager).to receive(:destroy).with(last_config.vm.ip, last_config.vsphere.resource_pool)
354
+ last_config.dig('vcenter_creds', 'ip'),
355
+ last_config.dig('vcenter_creds', 'username'),
356
+ last_config.dig('vcenter_creds', 'password'),
357
+ last_config.dig('vsphere', 'datacenter'),
358
+ instance_of(Logger),
359
+ ).and_return(last_ova_manager)
360
+ expect(last_ova_manager).to receive(:destroy).with(last_config.dig('vm', 'ip'), last_config.dig('vsphere', 'resource_pool'))
364
361
 
365
362
  manager.destroy
366
363
  end
@@ -369,8 +366,8 @@ module VmShepherd
369
366
  context 'when IAAS is AWS' do
370
367
  let(:settings_fixture_name) { 'aws.yml' }
371
368
  let(:aws_manager) { instance_double(AwsManager) }
372
- let(:first_ami_options) { {vm_name: 'vm-name'} }
373
- let(:last_ami_options) { {vm_name: 'vm-name-2'} }
369
+ let(:first_ami_options) { {'vm_name' => 'vm-name'} }
370
+ let(:last_ami_options) { {'vm_name' => 'vm-name-2'} }
374
371
 
375
372
  it 'uses AwsManager to destroy a VM' do
376
373
  expect(AwsManager).to receive(:new).with(env_config: aws_env_config, logger: instance_of(Logger)).and_return(aws_manager)
@@ -474,36 +471,36 @@ module VmShepherd
474
471
 
475
472
  it 'uses VcloudManager to destroy a vm' do
476
473
  expect(VcloudManager).to receive(:new).with(
477
- {
478
- url: first_config.creds.url,
479
- organization: first_config.creds.organization,
480
- user: first_config.creds.user,
481
- password: first_config.creds.password,
482
- },
483
- first_config.vdc.name,
484
- instance_of(Logger)
485
- ).and_return(first_vcloud_manager)
474
+ {
475
+ url: first_config.dig('creds', 'url'),
476
+ organization: first_config.dig('creds', 'organization'),
477
+ user: first_config.dig('creds', 'user'),
478
+ password: first_config.dig('creds', 'password'),
479
+ },
480
+ first_config.dig('vdc', 'name'),
481
+ instance_of(Logger)
482
+ ).and_return(first_vcloud_manager)
486
483
 
487
484
  expect(first_vcloud_manager).to receive(:clean_environment).with(
488
- first_config.vapp.product_names,
489
- first_config.vapp.product_catalog,
490
- )
485
+ first_config.dig('vapp', 'product_names'),
486
+ first_config.dig('vapp', 'product_catalog'),
487
+ )
491
488
 
492
489
  expect(VcloudManager).to receive(:new).with(
493
- {
494
- url: last_config.creds.url,
495
- organization: last_config.creds.organization,
496
- user: last_config.creds.user,
497
- password: last_config.creds.password,
498
- },
499
- last_config.vdc.name,
500
- instance_of(Logger)
501
- ).and_return(last_vcloud_manager)
490
+ {
491
+ url: last_config.dig('creds', 'url'),
492
+ organization: last_config.dig('creds', 'organization'),
493
+ user: last_config.dig('creds', 'user'),
494
+ password: last_config.dig('creds', 'password'),
495
+ },
496
+ last_config.dig('vdc', 'name'),
497
+ instance_of(Logger)
498
+ ).and_return(last_vcloud_manager)
502
499
 
503
500
  expect(last_vcloud_manager).to receive(:clean_environment).with(
504
- [],
505
- last_config.vapp.product_catalog,
506
- )
501
+ [],
502
+ last_config.dig('vapp', 'product_catalog'),
503
+ )
507
504
 
508
505
  manager.clean_environment
509
506
  end
@@ -514,36 +511,36 @@ module VmShepherd
514
511
  let(:first_ova_manager) { instance_double(VsphereManager) }
515
512
  let(:first_clean_environment_options) do
516
513
  {
517
- datacenter_folders_to_clean: first_config.cleanup.datacenter_folders_to_clean,
518
- datastores: first_config.cleanup.datastores,
519
- datastore_folders_to_clean: first_config.cleanup.datastore_folders_to_clean,
514
+ datacenter_folders_to_clean: first_config.dig('cleanup', 'datacenter_folders_to_clean'),
515
+ datastores: first_config.dig('cleanup', 'datastores'),
516
+ datastore_folders_to_clean: first_config.dig('cleanup', 'datastore_folders_to_clean'),
520
517
  }
521
518
  end
522
519
  let(:last_ova_manager) { instance_double(VsphereManager) }
523
520
  let(:last_clean_environment_options) do
524
521
  {
525
- datacenter_folders_to_clean: last_config.cleanup.datacenter_folders_to_clean,
526
- datastores: last_config.cleanup.datastores,
527
- datastore_folders_to_clean: last_config.cleanup.datastore_folders_to_clean,
522
+ datacenter_folders_to_clean: last_config.dig('cleanup', 'datacenter_folders_to_clean'),
523
+ datastores: last_config.dig('cleanup', 'datastores'),
524
+ datastore_folders_to_clean: last_config.dig('cleanup', 'datastore_folders_to_clean'),
528
525
  }
529
526
  end
530
527
 
531
528
  it 'uses VsphereManager to destroy a vm' do
532
529
  expect(VsphereManager).to receive(:new).with(
533
- first_config.vcenter_creds.ip,
534
- first_config.vcenter_creds.username,
535
- first_config.vcenter_creds.password,
536
- first_config.cleanup.datacenter,
537
- instance_of(Logger),
538
- ).and_return(first_ova_manager)
530
+ first_config.dig('vcenter_creds', 'ip'),
531
+ first_config.dig('vcenter_creds', 'username'),
532
+ first_config.dig('vcenter_creds', 'password'),
533
+ first_config.dig('cleanup', 'datacenter'),
534
+ instance_of(Logger),
535
+ ).and_return(first_ova_manager)
539
536
  expect(first_ova_manager).to receive(:clean_environment).with(first_clean_environment_options)
540
537
  expect(VsphereManager).to receive(:new).with(
541
- last_config.vcenter_creds.ip,
542
- last_config.vcenter_creds.username,
543
- last_config.vcenter_creds.password,
544
- last_config.cleanup.datacenter,
545
- instance_of(Logger),
546
- ).and_return(last_ova_manager)
538
+ last_config.dig('vcenter_creds', 'ip'),
539
+ last_config.dig('vcenter_creds', 'username'),
540
+ last_config.dig('vcenter_creds', 'password'),
541
+ last_config.dig('cleanup', 'datacenter'),
542
+ instance_of(Logger),
543
+ ).and_return(last_ova_manager)
547
544
  expect(last_ova_manager).to receive(:clean_environment).with(last_clean_environment_options)
548
545
 
549
546
  manager.clean_environment
@@ -642,28 +639,28 @@ module VmShepherd
642
639
 
643
640
  it 'uses VcloudManager to destroy a vm' do
644
641
  expect(VcloudManager).to receive(:new).with(
645
- {
646
- url: first_config.creds.url,
647
- organization: first_config.creds.organization,
648
- user: first_config.creds.user,
649
- password: first_config.creds.password,
650
- },
651
- first_config.vdc.name,
652
- instance_of(Logger)
653
- ).and_return(first_vcloud_manager)
642
+ {
643
+ url: first_config.dig('creds', 'url'),
644
+ organization: first_config.dig('creds', 'organization'),
645
+ user: first_config.dig('creds', 'user'),
646
+ password: first_config.dig('creds', 'password'),
647
+ },
648
+ first_config.dig('vdc', 'name'),
649
+ instance_of(Logger)
650
+ ).and_return(first_vcloud_manager)
654
651
 
655
652
  expect(first_vcloud_manager).to receive(:prepare_environment)
656
653
 
657
654
  expect(VcloudManager).to receive(:new).with(
658
- {
659
- url: last_config.creds.url,
660
- organization: last_config.creds.organization,
661
- user: last_config.creds.user,
662
- password: last_config.creds.password,
663
- },
664
- last_config.vdc.name,
665
- instance_of(Logger)
666
- ).and_return(last_vcloud_manager)
655
+ {
656
+ url: last_config.dig('creds', 'url'),
657
+ organization: last_config.dig('creds', 'organization'),
658
+ user: last_config.dig('creds', 'user'),
659
+ password: last_config.dig('creds', 'password'),
660
+ },
661
+ last_config.dig('vdc', 'name'),
662
+ instance_of(Logger)
663
+ ).and_return(last_vcloud_manager)
667
664
 
668
665
  expect(last_vcloud_manager).to receive(:prepare_environment)
669
666
  manager.prepare_environment
@@ -677,20 +674,20 @@ module VmShepherd
677
674
 
678
675
  it 'uses VsphereManager to destroy a vm' do
679
676
  expect(VsphereManager).to receive(:new).with(
680
- first_config.vcenter_creds.ip,
681
- first_config.vcenter_creds.username,
682
- first_config.vcenter_creds.password,
683
- first_config.vsphere.datacenter,
684
- instance_of(Logger),
685
- ).and_return(first_ova_manager)
677
+ first_config.dig('vcenter_creds', 'ip'),
678
+ first_config.dig('vcenter_creds', 'username'),
679
+ first_config.dig('vcenter_creds', 'password'),
680
+ first_config.dig('vsphere', 'datacenter'),
681
+ instance_of(Logger),
682
+ ).and_return(first_ova_manager)
686
683
  expect(first_ova_manager).to receive(:prepare_environment)
687
684
  expect(VsphereManager).to receive(:new).with(
688
- last_config.vcenter_creds.ip,
689
- last_config.vcenter_creds.username,
690
- last_config.vcenter_creds.password,
691
- last_config.vsphere.datacenter,
692
- instance_of(Logger),
693
- ).and_return(last_ova_manager)
685
+ last_config.dig('vcenter_creds', 'ip'),
686
+ last_config.dig('vcenter_creds', 'username'),
687
+ last_config.dig('vcenter_creds', 'password'),
688
+ last_config.dig('vsphere', 'datacenter'),
689
+ instance_of(Logger),
690
+ ).and_return(last_ova_manager)
694
691
  expect(last_ova_manager).to receive(:prepare_environment)
695
692
 
696
693
  manager.prepare_environment
@@ -30,7 +30,7 @@ module VmShepherd
30
30
  allow(client).to receive(:create_catalog).and_return(catalog)
31
31
  allow(catalog).to receive(:upload_vapp_template)
32
32
  allow(catalog).to receive(:instantiate_vapp_template).and_return(vapp)
33
- allow(vapp).to receive_message_chain(:vms, :first).and_return(vm)
33
+ allow(vapp).to receive(:find_vm_by_name).and_return(vm)
34
34
  allow(vm).to receive(:product_section_properties=)
35
35
  allow(vapp).to receive(:power_on)
36
36
 
@@ -140,7 +140,7 @@ module VmShepherd
140
140
 
141
141
  allow(VCloudSdk::NetworkConfig).to receive(:new).and_return(network_config)
142
142
 
143
- allow(vapp).to receive_message_chain(:vms, :first).and_return(vm)
143
+ allow(vapp).to receive(:find_vm_by_name).and_return(vm)
144
144
  allow(vm).to receive(:product_section_properties=)
145
145
  allow(vapp).to receive(:power_on)
146
146
  end
@@ -21,14 +21,13 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency 'fog', '1.34.0'
22
22
  spec.add_dependency 'net-ssh' # because fog uses this but doesn't require it
23
23
 
24
- spec.add_dependency 'recursive-open-struct', '~> 0.5.0' # newer versions break hash-key-is-symbol assumptions
25
-
26
- spec.add_dependency 'ruby_vcloud_sdk', '0.7.4'
24
+ spec.add_dependency 'ruby_vcloud_sdk', '0.7.2'
27
25
 
28
26
  spec.add_dependency 'rbvmomi'
29
27
 
30
28
  spec.add_development_dependency 'bundler'
31
29
  spec.add_development_dependency 'rake'
32
30
  spec.add_development_dependency 'rspec'
31
+ spec.add_development_dependency 'rubocop'
33
32
  spec.add_development_dependency 'codeclimate-test-reporter'
34
33
  end
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.12.7
4
+ version: 2.0.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: 2016-02-09 00:00:00.000000000 Z
11
+ date: 2016-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-v1
@@ -53,41 +53,41 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: recursive-open-struct
56
+ name: ruby_vcloud_sdk
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.5.0
61
+ version: 0.7.2
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.5.0
68
+ version: 0.7.2
69
69
  - !ruby/object:Gem::Dependency
70
- name: ruby_vcloud_sdk
70
+ name: rbvmomi
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.7.4
75
+ version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.7.4
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rbvmomi
84
+ name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
- type: :runtime
90
+ type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: bundler
98
+ name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rake
112
+ name: rspec
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: rspec
126
+ name: rubocop
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="