diff --git a/lib/vSphere/action/clone.rb b/lib/vSphere/action/clone.rb index d03a7489..f5bbe7bc 100644 --- a/lib/vSphere/action/clone.rb +++ b/lib/vSphere/action/clone.rb @@ -33,8 +33,8 @@ def call(env) spec[:customization] = get_customization_spec(machine, customization_info) unless customization_info.nil? env[:ui].info I18n.t('vsphere.creating_cloned_vm') - env[:ui].info " -- #{config.clone_from_vm ? "Source" : "Template"} VM: #{config.template_name}" - env[:ui].info " -- Name: #{name}" + env[:ui].info " -- #{config.clone_from_vm ? "Source" : "Template"} VM: #{template.pretty_path}" + env[:ui].info " -- Target VM: #{vm_base_folder.pretty_path}/#{name}" new_vm = template.CloneVM_Task(:folder => vm_base_folder, :name => name, :spec => spec).wait_for_completion rescue Errors::VSphereError => e diff --git a/spec/clone_spec.rb b/spec/clone_spec.rb index dfe3e6c5..176021e2 100644 --- a/spec/clone_spec.rb +++ b/spec/clone_spec.rb @@ -17,7 +17,8 @@ end it 'should create a CloneVM task with custom folder when given vm base path' do - custom_base_folder = double(CUSTOM_VM_FOLDER) + custom_base_folder = double(CUSTOM_VM_FOLDER, + :pretty_path => "#{@data_center.pretty_path}/#{CUSTOM_VM_FOLDER}") @machine.provider_config.stub(:vm_base_path).and_return(CUSTOM_VM_FOLDER) @data_center.vmFolder.stub(:traverse).with(CUSTOM_VM_FOLDER, RbVmomi::VIM::Folder).and_return(custom_base_folder) call diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 098c46d7..51562573 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -77,10 +77,12 @@ def call @data_center = double('data_center', :vmFolder => vm_folder, + :pretty_path => "data_center/#{vm_folder}", :find_compute_resource => double('compute resource', :resourcePool => double('pools', :find => {}))) @template = double('template_vm', :parent => @data_center, + :pretty_path => "#{@data_center.pretty_path}/template_vm", :CloneVM_Task => double('result', :wait_for_completion => double('new_vm', :config => double('config', :uuid => NEW_UUID))))