Skip to content

Commit

Permalink
improve logging: replace target vm name by full pretty_path
Browse files Browse the repository at this point in the history
  • Loading branch information
mikola-spb committed Jun 11, 2014
1 parent 8bf6af5 commit f0f5a6b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/vSphere/action/clone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion spec/clone_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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))))

Expand Down

0 comments on commit f0f5a6b

Please # to comment.