Skip to content

Commit

Permalink
Merge pull request #18451 from fdupont-redhat/v2v_escape_unicode_for_…
Browse files Browse the repository at this point in the history
…wrapper

Escape characters in SSH URI for virt-v2v
  • Loading branch information
agrare authored Feb 15, 2019
2 parents 3d26260 + 62b00ef commit b652050
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion app/models/service_template_transformation_plan_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,12 @@ def conversion_options_source_provider_vmwarews_vddk(_storage)

def conversion_options_source_provider_vmwarews_ssh(storage)
{
:vm_name => URI::Generic.build(:scheme => 'ssh', :userinfo => 'root', :host => source.host.ipaddress, :path => "/vmfs/volumes").to_s + "/#{storage.name}/#{source.location}",
:vm_name => URI::Generic.build(
:scheme => 'ssh',
:userinfo => 'root',
:host => source.host.ipaddress,
:path => "/vmfs/volumes/#{Addressable::URI.escape(storage.name)}/#{Addressable::URI.escape(source.location)}"
).to_s,
:transport_method => 'ssh'
}
end
Expand Down
6 changes: 3 additions & 3 deletions spec/models/service_template_transformation_plan_task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@
context 'source is vmwarews' do
let(:src_ems) { FactoryBot.create(:ems_vmware, :zone => FactoryBot.create(:zone)) }
let(:src_host) { FactoryBot.create(:host, :ext_management_system => src_ems, :ipaddress => '10.0.0.1') }
let(:src_storage) { FactoryBot.create(:storage, :ext_management_system => src_ems) }
let(:src_storage) { FactoryBot.create(:storage, :ext_management_system => src_ems, :name => 'stockage récent') }

let(:src_lan_1) { FactoryBot.create(:lan) }
let(:src_lan_2) { FactoryBot.create(:lan) }
Expand Down Expand Up @@ -497,7 +497,7 @@

it "generates conversion options hash" do
expect(task_1.conversion_options).to eq(
:vm_name => "ssh://root@10.0.0.1/vmfs/volumes/#{src_storage.name}/#{src_vm_1.location}",
:vm_name => "ssh://root@10.0.0.1/vmfs/volumes/stockage%20r%C3%A9cent/#{src_vm_1.location}",
:transport_method => 'ssh',
:rhv_url => "https://#{dst_ems.hostname}/ovirt-engine/api",
:rhv_cluster => dst_cluster.name,
Expand Down Expand Up @@ -606,7 +606,7 @@

it "generates conversion options hash" do
expect(task_1.conversion_options).to eq(
:vm_name => "ssh://root@10.0.0.1/vmfs/volumes/#{src_storage.name}/#{src_vm_1.location}",
:vm_name => "ssh://root@10.0.0.1/vmfs/volumes/stockage%20r%C3%A9cent/#{src_vm_1.location}",
:transport_method => 'ssh',
:osp_environment => {
:os_auth_url => URI::Generic.build(
Expand Down

0 comments on commit b652050

Please sign in to comment.