clc-chef-metal-vsphere 0.3.36 → 0.3.37
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef_metal_vsphere/version.rb +1 -1
- data/lib/chef_metal_vsphere/vsphere_driver.rb +4 -2
- data/lib/kitchen/driver/vsphere.rb +28 -0
- data/lib/kitchen/driver/vsphere_common.rb +49 -0
- data/lib/kitchen/driver/vsphere_windows.rb +29 -0
- data/spec/integration_tests/config.rb +51 -51
- data/spec/integration_tests/vsphere_driver_spec.rb +2 -3
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0783ab8e7deb238bcd63613ffdb35cfb342034f
|
4
|
+
data.tar.gz: e538c2b3f5023184862db5e79e504c10a8a58bc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54577970fbdcee6fcdf8a47d4f193cde9d21b7f9ae775db5889473bc0cffb718ffd435ffa7b892644d7324a7f4fbe37518a5681b26efd3f6242e7011b24c3a50
|
7
|
+
data.tar.gz: a59b49d388f7fbaa10d1ae33bb7648d926614bbcccaaa9f7c5c2f1436ccf85b9a29a6a3d55bf502cb1ffc9fdcb50d7592969d5295b3916902972b8ec76dd1d9d
|
@@ -223,12 +223,14 @@ module ChefMetalVsphere
|
|
223
223
|
restart_server(action_handler, machine_spec, vm)
|
224
224
|
end
|
225
225
|
now = Time.now.utc
|
226
|
-
until (Time.now.utc - now) >
|
226
|
+
until (Time.now.utc - now) > 90 || (vm.guest.net.map { |net| net.ipAddress}.flatten).include?(vm_ip) do
|
227
|
+
vm_ip = ip_for(bootstrap_options, vm) if vm_ip.nil?
|
227
228
|
print "-"
|
228
229
|
sleep 5
|
229
230
|
end
|
230
231
|
end
|
231
|
-
|
232
|
+
machine_spec.location['ipaddress'] = vm.guest.ipAddress
|
233
|
+
action_handler.report_progress "IP address obtained: #{machine_spec.location['ipaddress']}"
|
232
234
|
end
|
233
235
|
|
234
236
|
domain = bootstrap_options[:customization_spec][:domain]
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'kitchen/driver/vsphere_common'
|
2
|
+
|
3
|
+
module Kitchen
|
4
|
+
module Driver
|
5
|
+
class Vsphere < Kitchen::Driver::SSHBase
|
6
|
+
|
7
|
+
default_config :machine_options,
|
8
|
+
:start_timeout => 600,
|
9
|
+
:create_timeout => 600,
|
10
|
+
:ready_timeout => 90,
|
11
|
+
:bootstrap_options => {
|
12
|
+
:use_linked_clone => true,
|
13
|
+
:ssh => {
|
14
|
+
:user => 'root',
|
15
|
+
:paranoid => false,
|
16
|
+
:port => 22
|
17
|
+
},
|
18
|
+
:convergence_options => {},
|
19
|
+
:customization_spec => {
|
20
|
+
:domain => 'local'
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
include Kitchen::Driver::VsphereCommon
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'benchmark'
|
2
|
+
require 'kitchen'
|
3
|
+
require 'chef_metal_vsphere/vsphere_driver'
|
4
|
+
require 'chef_metal/chef_machine_spec'
|
5
|
+
|
6
|
+
module Kitchen
|
7
|
+
module Driver
|
8
|
+
module VsphereCommon
|
9
|
+
def create(state)
|
10
|
+
config[:server_name] ||= "kitchen-#{SecureRandom.hex}-#{instance.name}"
|
11
|
+
state[:username] = config[:machine_options][:bootstrap_options][:ssh][:user]
|
12
|
+
state[:password] = config[:machine_options][:bootstrap_options][:ssh][:password]
|
13
|
+
|
14
|
+
machine = with_metal_driver(config[:server_name]) do | action_handler, driver, machine_spec|
|
15
|
+
driver.allocate_machine(action_handler, machine_spec, config[:machine_options])
|
16
|
+
driver.ready_machine(action_handler, machine_spec, config[:machine_options])
|
17
|
+
state[:server_id] = machine_spec.location['server_id']
|
18
|
+
state[:hostname] = machine_spec.location['ipaddress']
|
19
|
+
state[:vsphere_name] = config[:server_name]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def destroy(state)
|
24
|
+
return if state[:server_id].nil?
|
25
|
+
|
26
|
+
with_metal_driver(state[:vsphere_name]) do | action_handler, driver, machine_spec|
|
27
|
+
machine_spec.location = { 'driver_url' => driver.driver_url,
|
28
|
+
'server_id' => state[:server_id]}
|
29
|
+
driver.destroy_machine(action_handler, machine_spec, config[:machine_options])
|
30
|
+
end
|
31
|
+
|
32
|
+
state.delete(:server_id)
|
33
|
+
state.delete(:hostname)
|
34
|
+
state.delete(:vsphere_name)
|
35
|
+
end
|
36
|
+
|
37
|
+
def with_metal_driver(name, &block)
|
38
|
+
Cheffish.honor_local_mode do
|
39
|
+
chef_server = Cheffish.default_chef_server(Cheffish.profiled_config)
|
40
|
+
config[:machine_options][:convergence_options] = {:chef_server => chef_server}
|
41
|
+
machine_spec = ChefMetal::ChefMachineSpec.new({'name' => name}, chef_server)
|
42
|
+
driver = ChefMetal.driver_for_url("vsphere://#{config[:driver_options][:host]}", config)
|
43
|
+
action_handler = ChefMetal::ActionHandler.new
|
44
|
+
block.call(action_handler, driver, machine_spec)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'kitchen/driver/vsphere_common'
|
2
|
+
|
3
|
+
module Kitchen
|
4
|
+
module Driver
|
5
|
+
class VsphereWindows < Kitchen::Driver::WinRMBase
|
6
|
+
|
7
|
+
default_config :machine_options,
|
8
|
+
:start_timeout => 600,
|
9
|
+
:create_timeout => 600,
|
10
|
+
:ready_timeout => 90,
|
11
|
+
:bootstrap_options => {
|
12
|
+
:use_linked_clone => true,
|
13
|
+
:ssh => {
|
14
|
+
:user => 'administrator',
|
15
|
+
},
|
16
|
+
:convergence_options => {},
|
17
|
+
:customization_spec => {
|
18
|
+
:domain => 'local',
|
19
|
+
:org_name => 'Tier3',
|
20
|
+
:product_id => 'W3GGN-FT8W3-Y4M27-J84CP-Q3VJ9',
|
21
|
+
:win_time_zone => 4
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
include Kitchen::Driver::VsphereCommon
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,52 +1,52 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
1
|
+
{
|
2
|
+
:driver_options => {
|
3
|
+
:host => '172.21.10.10',
|
4
|
+
:user => 'vmapi',
|
5
|
+
:password => 'Pass@word1',
|
6
|
+
:insecure => true
|
7
|
+
},
|
8
|
+
:machine_options => {
|
9
|
+
:start_timeout => 600,
|
10
|
+
:create_timeout => 600,
|
11
|
+
:ready_timeout => 300,
|
12
|
+
:bootstrap_options => {
|
13
|
+
:use_linked_clone => true,
|
14
|
+
:datacenter => 'QA1',
|
15
|
+
#:template_name => 'UBUNTU-12-64-TEMPLATE',
|
16
|
+
:template_name => 'WINDEVOPS2012R2',
|
17
|
+
:vm_folder => 'DLAB',
|
18
|
+
:datastore => 'QA1-2-SFIRE-01',
|
19
|
+
:num_cpus => 2,
|
20
|
+
#:network_name => ['vlan_20_172.21.20'],
|
21
|
+
#:network_name => ['vlan10_172.21.10-vm'],
|
22
|
+
:network_name => ['vlan10_172.21.10-vm', 'vlan_20_172.21.20'],
|
23
|
+
:memory_mb => 4096,
|
24
|
+
:resource_pool => 'CLSTR02/DLAB',
|
25
|
+
:additional_disk_size_gb => 50,
|
26
|
+
:ssh => {
|
27
|
+
#:user => 'root',
|
28
|
+
:user => 'administrator',
|
29
|
+
:password => 'Password123',
|
30
|
+
:paranoid => false,
|
31
|
+
:port => 22
|
32
|
+
},
|
33
|
+
:convergence_options => {},
|
34
|
+
:customization_spec => {
|
35
|
+
:ipsettings => {
|
36
|
+
:ip => '172.21.10.190',
|
37
|
+
:subnetMask => '255.255.255.0',
|
38
|
+
:gateway => ["172.21.10.1"],
|
39
|
+
:dnsServerList => ["192.168.64.19","192.168.64.20"]
|
40
|
+
},
|
41
|
+
:domain => 't3n.dom',
|
42
|
+
:domainAdmin => "tier3sa@t3n.dom",
|
43
|
+
:domainAdminPassword => '4u2bn01!!@#$',
|
44
|
+
:org_name => 'Tier3',
|
45
|
+
:product_id => 'W3GGN-FT8W3-Y4M27-J84CP-Q3VJ9',
|
46
|
+
:win_time_zone => 4
|
47
|
+
}
|
48
|
+
}
|
49
|
+
},
|
50
|
+
:log_level => :debug
|
51
|
+
}
|
52
52
|
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'chef_metal_vsphere/vsphere_driver'
|
2
|
-
#require 'chef_metal_vsphere/ubuntu_patch'
|
3
2
|
require 'chef_metal/chef_machine_spec'
|
4
3
|
|
5
4
|
# A file named config.rb in the same directory as this spec file
|
@@ -41,7 +40,7 @@ describe "vsphere_driver" do
|
|
41
40
|
@vm_name = "cmvd-test-#{SecureRandom.hex}"
|
42
41
|
@metal_config = eval File.read(File.expand_path('../config.rb', __FILE__))
|
43
42
|
Cheffish.honor_local_mode do
|
44
|
-
chef_server = Cheffish.default_chef_server(
|
43
|
+
chef_server = Cheffish.default_chef_server(Cheffish.profiled_config)
|
45
44
|
puts "chef server:#{chef_server}"
|
46
45
|
@machine_spec = ChefMetal::ChefMachineSpec.new({'name' => @vm_name}, chef_server)
|
47
46
|
@driver = ChefMetal.driver_for_url("vsphere://#{@metal_config[:driver_options][:host]}", @metal_config)
|
@@ -125,7 +124,7 @@ describe "vsphere_driver" do
|
|
125
124
|
|
126
125
|
it "removes the machine" do
|
127
126
|
Cheffish.honor_local_mode do
|
128
|
-
chef_server = Cheffish.default_chef_server(
|
127
|
+
chef_server = Cheffish.default_chef_server(Cheffish.profiled_config)
|
129
128
|
driver = ChefMetal.driver_for_url("vsphere://#{@metal_config[:driver_options][:host]}", @metal_config)
|
130
129
|
action_handler = ChefMetal::ActionHandler.new
|
131
130
|
machine_spec = ChefMetal::ChefMachineSpec.new({'name' => @vm_name}, chef_server)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clc-chef-metal-vsphere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.37
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CenturyLink Cloud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef
|
@@ -95,6 +95,9 @@ files:
|
|
95
95
|
- lib/chef_metal_vsphere/vsphere_driver.rb
|
96
96
|
- lib/chef_metal_vsphere/vsphere_helpers.rb
|
97
97
|
- lib/chef_metal_vsphere/vsphere_url.rb
|
98
|
+
- lib/kitchen/driver/vsphere.rb
|
99
|
+
- lib/kitchen/driver/vsphere_common.rb
|
100
|
+
- lib/kitchen/driver/vsphere_windows.rb
|
98
101
|
- spec/integration_tests/.gitignore
|
99
102
|
- spec/integration_tests/config.rb
|
100
103
|
- spec/integration_tests/vsphere_driver_spec.rb
|