Skip to content

Commit f0f5a6b

Browse files
committed
improve logging: replace target vm name by full pretty_path
1 parent 8bf6af5 commit f0f5a6b

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

lib/vSphere/action/clone.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def call(env)
3333
spec[:customization] = get_customization_spec(machine, customization_info) unless customization_info.nil?
3434

3535
env[:ui].info I18n.t('vsphere.creating_cloned_vm')
36-
env[:ui].info " -- #{config.clone_from_vm ? "Source" : "Template"} VM: #{config.template_name}"
37-
env[:ui].info " -- Name: #{name}"
36+
env[:ui].info " -- #{config.clone_from_vm ? "Source" : "Template"} VM: #{template.pretty_path}"
37+
env[:ui].info " -- Target VM: #{vm_base_folder.pretty_path}/#{name}"
3838

3939
new_vm = template.CloneVM_Task(:folder => vm_base_folder, :name => name, :spec => spec).wait_for_completion
4040
rescue Errors::VSphereError => e

spec/clone_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
end
1818

1919
it 'should create a CloneVM task with custom folder when given vm base path' do
20-
custom_base_folder = double(CUSTOM_VM_FOLDER)
20+
custom_base_folder = double(CUSTOM_VM_FOLDER,
21+
:pretty_path => "#{@data_center.pretty_path}/#{CUSTOM_VM_FOLDER}")
2122
@machine.provider_config.stub(:vm_base_path).and_return(CUSTOM_VM_FOLDER)
2223
@data_center.vmFolder.stub(:traverse).with(CUSTOM_VM_FOLDER, RbVmomi::VIM::Folder).and_return(custom_base_folder)
2324
call

spec/spec_helper.rb

+2
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,12 @@ def call
7777

7878
@data_center = double('data_center',
7979
:vmFolder => vm_folder,
80+
:pretty_path => "data_center/#{vm_folder}",
8081
:find_compute_resource => double('compute resource', :resourcePool => double('pools', :find => {})))
8182

8283
@template = double('template_vm',
8384
:parent => @data_center,
85+
:pretty_path => "#{@data_center.pretty_path}/template_vm",
8486
:CloneVM_Task => double('result',
8587
:wait_for_completion => double('new_vm', :config => double('config', :uuid => NEW_UUID))))
8688

0 commit comments

Comments
 (0)