Skip to content

Commit

Permalink
Move escape inside 'path' and add specs
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiendupont committed Feb 15, 2019
1 parent 3b56faa commit 9a39485
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 + "/#{CGI.escape(storage.name)}/#{CGI.escape(source.location)}",
:vm_name => URI::Generic.build(
:scheme => 'ssh',
:userinfo => 'root',
:host => source.host.ipaddress,
:path => "/vmfs/volumes/#{URI.escape(storage.name)}/#{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://[email protected]/vmfs/volumes/#{src_storage.name}/#{src_vm_1.location}",
:vm_name => "ssh://[email protected]/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://[email protected]/vmfs/volumes/#{src_storage.name}/#{src_vm_1.location}",
:vm_name => "ssh://[email protected]/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 9a39485

Please sign in to comment.