chef-provisioning-vsphere 2.2.1 → 2.2.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/CHANGELOG.md +8 -1
- data/Rakefile +1 -1
- data/chef-provisioning-vsphere.gemspec +1 -1
- data/lib/chef/provisioning/vsphere_driver/clone_spec_builder.rb +1 -1
- data/lib/chef/provisioning/vsphere_driver/driver.rb +10 -9
- data/lib/chef/provisioning/vsphere_driver/version.rb +1 -1
- data/lib/chef/provisioning/vsphere_driver/vm_helper.rb +0 -6
- data/lib/kitchen/driver/vsphere.rb +3 -3
- data/spec/unit_tests/VsphereDriver_spec.rb +90 -0
- 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: 37f82ea348c58634c6971b8714c71b31c91c0cc5
|
4
|
+
data.tar.gz: d31a7417afd87dd0b475a81ffb529a6c990de31e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2653688852fe8b84876266ffc34a674cc82f038b39958af172c378d80ddabf7e0921a0daaaff11c5d4a7be69ea670faae77a744ef136df41dbd81d421bfff0a5
|
7
|
+
data.tar.gz: da5199536bf1a4122085fab98ab11b5db08cecad6ef346b19fc17337b1d2c948d9c0f6b3c3e911c89650ab24a19ee9f0d2342b728b97cc80baf8e7d731b5621f
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [v2.2.
|
3
|
+
## [v2.2.2](https://github.com/chef-partners/chef-provisioning-vsphere/tree/v2.2.2)
|
4
4
|
|
5
|
+
[Full Changelog](https://github.com/chef-partners/chef-provisioning-vsphere/compare/v2.2.1...v2.2.2)
|
6
|
+
|
7
|
+
**Merged pull requests:**
|
8
|
+
|
9
|
+
- Fix bug where ip address is not returned from guest tools [\#85](https://github.com/chef-partners/chef-provisioning-vsphere/pull/85) ([josh-barker](https://github.com/josh-barker))
|
10
|
+
|
11
|
+
## [v2.2.1](https://github.com/chef-partners/chef-provisioning-vsphere/tree/v2.2.1) (2018-06-04)
|
5
12
|
[Full Changelog](https://github.com/chef-partners/chef-provisioning-vsphere/compare/v2.2.0...v2.2.1)
|
6
13
|
|
7
14
|
**Merged pull requests:**
|
data/Rakefile
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.homepage = 'https://github.com/chef-partners/chef-provisioning-vsphere'
|
17
17
|
s.license = 'MIT'
|
18
18
|
s.bindir = 'bin'
|
19
|
-
s.executables = %w
|
19
|
+
s.executables = %w()
|
20
20
|
s.require_path = 'lib'
|
21
21
|
s.files = `git ls-files -z`.split("\x0")
|
22
22
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
@@ -178,7 +178,7 @@ module ChefProvisioningVsphere
|
|
178
178
|
def hostname_from(options, vm_name)
|
179
179
|
hostname = options[:hostname] || vm_name
|
180
180
|
test = /^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])$/
|
181
|
-
unless hostname.match(test)
|
181
|
+
unless hostname.match?(test)
|
182
182
|
raise 'Only letters, numbers or hyphens in hostnames allowed'
|
183
183
|
end
|
184
184
|
RbVmomi::VIM::CustomizationFixedName.new(name: hostname)
|
@@ -868,26 +868,27 @@ module ChefProvisioningVsphere
|
|
868
868
|
def ip_to_bootstrap(bootstrap_options, vm)
|
869
869
|
start_time = Time.now.utc
|
870
870
|
timeout = bootstrap_ip_ready_timeout(bootstrap_options)
|
871
|
-
|
871
|
+
vm_helper.find_port?(vm, bootstrap_options) unless vm_helper.port?
|
872
|
+
|
872
873
|
# First get the IP to be tested
|
873
874
|
if has_static_ip(bootstrap_options)
|
874
875
|
if bootstrap_options[:customization_spec].is_a?(String)
|
875
876
|
spec = vsphere_helper.find_customization_spec(bootstrap_options[:customization_spec])
|
876
|
-
vm_ip = spec.nicSettingMap[0].adapter.ip.ipAddress
|
877
|
+
vm_ip = spec.nicSettingMap[0].adapter.ip.ipAddress
|
877
878
|
else
|
878
879
|
## Check if true available
|
879
|
-
vm_ip = bootstrap_options[:customization_spec][:ipsettings][:ip]
|
880
|
-
nb_attempts = 0
|
881
|
-
until @vm_helper.open_port?(vm_ip, @vm_helper.port, 1) || (nb_attempts > (bootstrap_options[:ready_timeout] || 90))
|
882
|
-
print '.'
|
883
|
-
nb_attempts += 1
|
884
|
-
end
|
880
|
+
vm_ip = bootstrap_options[:customization_spec][:ipsettings][:ip]
|
885
881
|
end
|
886
882
|
elsif use_ipv4_during_bootstrap?(bootstrap_options)
|
887
883
|
vm_ip = wait_for_ipv4(bootstrap_ipv4_timeout(bootstrap_options), vm)
|
888
884
|
else
|
889
|
-
|
885
|
+
until vm_guest_ip?(vm) || Time.now.utc - start_time > timeout
|
886
|
+
print '.'
|
887
|
+
sleep 1
|
888
|
+
end
|
889
|
+
vm_ip = vm.guest.ipAddress
|
890
890
|
end
|
891
|
+
|
891
892
|
# Then check that it is reachable
|
892
893
|
until Time.now.utc - start_time > timeout
|
893
894
|
print '.'
|
@@ -23,12 +23,12 @@ module Kitchen
|
|
23
23
|
ssh: {
|
24
24
|
user: 'root',
|
25
25
|
paranoid: false,
|
26
|
-
port: 22
|
26
|
+
port: 22
|
27
27
|
},
|
28
28
|
convergence_options: {},
|
29
29
|
customization_spec: {
|
30
|
-
domain: 'local'
|
31
|
-
}
|
30
|
+
domain: 'local'
|
31
|
+
}
|
32
32
|
}
|
33
33
|
|
34
34
|
default_config(:vsphere_name) do |driver|
|
@@ -130,4 +130,94 @@ describe ChefProvisioningVsphere::VsphereDriver do
|
|
130
130
|
end
|
131
131
|
end
|
132
132
|
end
|
133
|
+
|
134
|
+
context "#ip_to_bootstrap" do
|
135
|
+
let(:metal_config) { {} }
|
136
|
+
let(:vm) { double("vm") }
|
137
|
+
let(:vm_helper) do
|
138
|
+
double("vm_helper")
|
139
|
+
end
|
140
|
+
before do
|
141
|
+
allow_any_instance_of(Kernel).to receive(:print)
|
142
|
+
end
|
143
|
+
|
144
|
+
before do
|
145
|
+
allow(subject).to receive(:vm_helper).and_return(vm_helper)
|
146
|
+
|
147
|
+
allow(vm_helper).to receive(:find_port?)
|
148
|
+
allow(vm_helper).to receive(:port?)
|
149
|
+
allow(vm_helper).to receive(:port).and_return(port)
|
150
|
+
end
|
151
|
+
|
152
|
+
let(:port) { 22 }
|
153
|
+
let(:bootstrap_conf) { {} }
|
154
|
+
|
155
|
+
context "has_static_ip" do
|
156
|
+
let(:bootstrap_conf) { { customization_spec: "some spec" } }
|
157
|
+
context "customization_spec is named" do
|
158
|
+
let(:vsphere_helper) { double("vsphere_helper") }
|
159
|
+
let(:fake_spec) { double("fake_spec") }
|
160
|
+
let(:fake_adapter) { double("fake_adapter") }
|
161
|
+
let(:fake_ip) do
|
162
|
+
RbVmomi::VIM::CustomizationFixedIp(
|
163
|
+
ipAddress: "1.1.1.1"
|
164
|
+
)
|
165
|
+
end
|
166
|
+
|
167
|
+
it "return ip address" do
|
168
|
+
allow(subject).to receive(:vsphere_helper).and_return(vsphere_helper)
|
169
|
+
allow(fake_adapter).to receive_message_chain(:adapter, :ip).and_return(fake_ip)
|
170
|
+
allow(fake_spec).to receive(:nicSettingMap).and_return([fake_adapter])
|
171
|
+
allow(vsphere_helper).to receive(:find_customization_spec).and_return(fake_spec)
|
172
|
+
allow(vm_helper).to receive(:open_port?).with("1.1.1.1", port, 1).and_return(true)
|
173
|
+
|
174
|
+
result = subject.send :ip_to_bootstrap, bootstrap_conf, vm
|
175
|
+
expect(result).to eq "1.1.1.1"
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
context "customization_spec has an ip address" do
|
180
|
+
let(:bootstrap_conf) do
|
181
|
+
{
|
182
|
+
customization_spec: {
|
183
|
+
ipsettings: {
|
184
|
+
ip: "2.2.2.2"
|
185
|
+
}
|
186
|
+
}
|
187
|
+
}
|
188
|
+
end
|
189
|
+
|
190
|
+
it "returns ip address" do
|
191
|
+
allow(vm_helper).to receive(:ip?)
|
192
|
+
allow(vm_helper).to receive(:open_port?).with("2.2.2.2", port, 1).and_return(true)
|
193
|
+
result = subject.send :ip_to_bootstrap, bootstrap_conf, vm
|
194
|
+
expect(result).to eq "2.2.2.2"
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
context "use_ipv4_during_bootstrap" do
|
200
|
+
let(:bootstrap_conf) { { bootstrap_ipv4: true } }
|
201
|
+
|
202
|
+
it "returns ip address" do
|
203
|
+
allow(subject).to receive(:wait_for_ipv4).and_return("3.3.3.3")
|
204
|
+
allow(vm_helper).to receive(:open_port?).with("3.3.3.3", port, 1).and_return(true)
|
205
|
+
|
206
|
+
result = subject.send :ip_to_bootstrap, bootstrap_conf, vm
|
207
|
+
expect(result).to eq "3.3.3.3"
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
context "wait until guest tools returns an IP address" do
|
212
|
+
it "returns ip address" do
|
213
|
+
allow_any_instance_of(Kernel).to receive(:sleep)
|
214
|
+
expect(subject).to receive(:vm_guest_ip?).exactly(3).times.and_return(false, false, true)
|
215
|
+
allow(vm).to receive_message_chain(:guest, :ipAddress).and_return("4.4.4.4")
|
216
|
+
|
217
|
+
allow(vm_helper).to receive(:open_port?).exactly(1).times.with("4.4.4.4", port, 1).and_return(true)
|
218
|
+
result = subject.send :ip_to_bootstrap, bootstrap_conf, vm
|
219
|
+
expect(result).to eq "4.4.4.4"
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
133
223
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-provisioning-vsphere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CenturyLink Cloud
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-06-
|
12
|
+
date: 2018-06-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chef
|