kitchen-vcenter 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ad83365e404c24b62793647a264cc753dcd8c39
4
- data.tar.gz: 39add38626871f3a8720cd2bff7c28cdb904d56a
3
+ metadata.gz: 454d333022d2532747b2ed4898e73a6c7dcd1c1d
4
+ data.tar.gz: ae47fafaebc7877904ad593189c0ea80f58e9be5
5
5
  SHA512:
6
- metadata.gz: 9acb72a51bae96c57eff8b8b7074b132b22b3c07c28c1ad781d20e60a1ee2db173c3df65b420b290db929f54cc4b0e07e04dc5ef75a8a78f3d4ef0ff3c39c13b
7
- data.tar.gz: 0c1b2ab4a0426c987047ab6843aa4f852604ecb2c068c4533b4d1c302dbaa509a4fad1875baa6376bfc69d7f9f4f4cf18832c53e225f066178e97b20916ba27d
6
+ metadata.gz: e90f3149b3fe275fd802cd62998cb03b8787a1a059b30635093b96b6e597da0c600c3f7f8eec5d25bbafc2ccaa84d9cff797ce5ed150354e7d70a4619c988f65
7
+ data.tar.gz: 2c03bbfb40de07916c0fd42d6eaf1caf7a07c1cd9ddef96474ce011798bfc5adabbd0c23b37e342d7f0b9bd87b35a1f8cac335e740540aaeb621e6b33e74901d
data/CHANGELOG.md CHANGED
@@ -1,7 +1,14 @@
1
1
  # Change Log
2
2
 
3
- ## [1.1.0](https://github.com/chef/kitchen-vcenter/tree/1.1.0) (2017-09-07)
4
- [Full Changelog](https://github.com/chef/kitchen-vcenter/compare/v1.0.0...1.1.0)
3
+ ## [1.2.0](https://github.com/chef/kitchen-vcenter/tree/1.2.0) (2017-09-12)
4
+ [Full Changelog](https://github.com/chef/kitchen-vcenter/compare/v1.1.0...1.2.0)
5
+
6
+ **Merged pull requests:**
7
+
8
+ - Resource pool and target host no longer have to be specified. [\#10](https://github.com/chef/kitchen-vcenter/pull/10) ([russellseymour](https://github.com/russellseymour))
9
+
10
+ ## [v1.1.0](https://github.com/chef/kitchen-vcenter/tree/v1.1.0) (2017-09-07)
11
+ [Full Changelog](https://github.com/chef/kitchen-vcenter/compare/v1.0.0...v1.1.0)
5
12
 
6
13
  **Closed issues:**
7
14
 
data/README.md CHANGED
@@ -48,9 +48,7 @@ driver:
48
48
  vcenter_host: vcenter.chef.io
49
49
  vcenter_disable_ssl_verify: true
50
50
  driver_config:
51
- targethost: 172.16.20.41
52
51
  datacenter: "Datacenter"
53
- resource_pool: "testkitchen"
54
52
 
55
53
  platforms:
56
54
  - name: ubuntu-1604
@@ -73,16 +71,16 @@ The following parameters should be set in the main `driver_config` section as th
73
71
 
74
72
  The following parameters should be set in the `driver_config` for the individual platform.
75
73
 
76
- - `targethost` - Host on which the new virtual machine should be created
77
74
  - `template` - Template or virtual machine to use when cloning the new machine
78
75
  - `datacenter` - Name of the datacenter to use to deploy into
79
- - `resource_pool` - Name of the resource pool to use when creating the machine. The resource pool _must_ already exist
80
76
 
81
77
  ### Optional Parameters
82
78
 
83
79
  The following optional parameters should be used in the `driver_config` for the platform.
84
80
 
85
- - `folder` - Folder into which the new machine should be stored. If specified the folder _must_ already exist
81
+ - `targethost` - Host on which the new virtual machine should be created. If not specified then the first host in the cluster is used.
82
+ - `folder` - Folder into which the new machine should be stored. If specified the folder _must_ already exist.
83
+ - `resource_pool` - Name of the resource pool to use when creating the machine. If specified the resource pool _must_ already exist
86
84
 
87
85
  ## Contributing
88
86
 
@@ -18,5 +18,5 @@
18
18
  #
19
19
 
20
20
  module KitchenVcenter
21
- VERSION = '1.1.0'.freeze
21
+ VERSION = '1.2.0'.freeze
22
22
  end
@@ -55,7 +55,7 @@ module Kitchen
55
55
  config[:vm_name] = format('%s-%s-%s', instance.suite.name, instance.platform.name, SecureRandom.hex(4))
56
56
  end
57
57
 
58
- raise "Please set the resource pool name using `resource_pool` parameter in the 'drive_config' section of your .kitchen.yml file" if config[:resource_pool].nil?
58
+ # raise "Please set the resource pool name using `resource_pool` parameter in the 'drive_config' section of your .kitchen.yml file" if config[:resource_pool].nil?
59
59
 
60
60
  connect
61
61
 
@@ -127,9 +127,15 @@ module Kitchen
127
127
  end
128
128
 
129
129
  def get_host(name)
130
- filter = Com::Vmware::Vcenter::Host::FilterSpec.new(names: Set.new([name]))
130
+ # create a host object to work with
131
131
  host_obj = Com::Vmware::Vcenter::Host.new(vapi_config)
132
- host = host_obj.list(filter)
132
+
133
+ if name.nil?
134
+ host = host_obj.list
135
+ else
136
+ filter = Com::Vmware::Vcenter::Host::FilterSpec.new(names: Set.new([name]))
137
+ host = host_obj.list(filter)
138
+ end
133
139
 
134
140
  raise format('Unable to find target host: %s', name) if host.empty?
135
141
 
@@ -139,7 +145,6 @@ module Kitchen
139
145
  def get_folder(name)
140
146
  # Create a filter to ensure that only the named folder is returned
141
147
  filter = Com::Vmware::Vcenter::Folder::FilterSpec.new(names: Set.new([name]))
142
- # filter.names = name
143
148
  folder_obj = Com::Vmware::Vcenter::Folder.new(vapi_config)
144
149
  folder = folder_obj.list(filter)
145
150
 
@@ -155,12 +160,20 @@ module Kitchen
155
160
  end
156
161
 
157
162
  def get_resource_pool(name)
158
- # Create a filter to ensure that only the specified resource pool is returned, if it exists
159
- filter = Com::Vmware::Vcenter::ResourcePool::FilterSpec.new(names: Set.new([name]))
163
+ # Create a resource pool object
160
164
  rp_obj = Com::Vmware::Vcenter::ResourcePool.new(vapi_config)
161
- resource_pool = rp_obj.list(filter)
162
165
 
163
- raise format('Unable to find Resource Pool: %s', name) if resource_pool.empty?
166
+ # If a name has been set then try to find it, otherwise use the first
167
+ # resource pool that can be found
168
+ if name.nil?
169
+ resource_pool = rp_obj.list
170
+ else
171
+ # create a filter to find the named resource pool
172
+ filter = Com::Vmware::Vcenter::ResourcePool::FilterSpec.new(names: Set.new([name]))
173
+ resource_pool = rp_obj.list(filter)
174
+ end
175
+
176
+ raise format('Unable to find Resource Pool: %s', name) if resource_pool.nil?
164
177
 
165
178
  resource_pool[0].resource_pool
166
179
  end
@@ -16,9 +16,13 @@ class Support
16
16
  dc = vim.serviceInstance.find_datacenter(options[:datacenter])
17
17
  src_vm = dc.find_vm(options[:template])
18
18
 
19
+ raise format("Unable to find template: %s", options[:template]) if src_vm.nil?
20
+
19
21
  # Specify where the machine is going to be created
20
22
  relocate_spec = RbVmomi::VIM.VirtualMachineRelocateSpec
21
23
  relocate_spec.host = options[:targethost]
24
+
25
+ # Set the resource pool
22
26
  relocate_spec.pool = options[:resource_pool]
23
27
 
24
28
  clone_spec = RbVmomi::VIM.VirtualMachineCloneSpec(location: relocate_spec,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-vcenter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Russell Seymour
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-07 00:00:00.000000000 Z
11
+ date: 2017-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen