-
Notifications
You must be signed in to change notification settings - Fork 898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Escape characters in SSH URI for virt-v2v #18451
Escape characters in SSH URI for virt-v2v #18451
Conversation
@miq-bot add-label transformation, bug, hammer/yes, wip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appropriate fix. Looks good!
Looks ok to me though a spec would be good. Edit: oops, I should have said this as part of the "review". See below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method needs specs. Doesn't have to be anything fancy, but something would be good.
@djberg96 how a spec would look like for this kind of escaping ? Do you have an example ? |
@fdupont-redhat how about a spec testing the output of |
@@ -283,7 +283,7 @@ 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").to_s + "/#{CGI.escape(storage.name)}/#{CGI.escape(source.location)}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.to_s + "/#{CGI.escape(storage.name)}/#{CGI.escape(source.location)}"
This should be part of the path passed to URI::Generic.build
not tacked on the end, also recommend building a local variable path
to keep the line length down.
@fdupont-redhat Looks like it's a private method, so we don't test it directly. Instead I think you could mostly copy https://github.com/ManageIQ/manageiq/blob/master/spec/models/service_template_transformation_plan_task_spec.rb#L488-L501 and just create a storage factory that contains non-ascii characters. |
cc2cb67
to
9a39485
Compare
Checked commits fabiendupont/manageiq@cb677f9~...62b00ef with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
Addressable::URI, eh? Huh. |
Didn't have much choice as CGI.escape converts space to +, instead of %20. Found it on stackoverflow. |
@fdupont-redhat #17502 |
…wrapper Escape characters in SSH URI for virt-v2v (cherry picked from commit b652050) https://bugzilla.redhat.com/show_bug.cgi?id=1678385
Hammer backport details:
|
@fdupont-redhat please take a look at Travis failure in Hammer branch: |
@simaishi I don't see how my code can generate that kind of error. The error message talk about LDAP authentication failure, tag assignment error, job aborting... Looks like the test environment is wrong. Are there other PRs failing with the same kind of errors ? |
@fdupont-redhat there were two failures and they both look related to service_template_transformation_plan_task: https://travis-ci.org/ManageIQ/manageiq/builds/494991766#L9645-L9697 The specs passed before this one PR was backported. |
Seeing two failures locally on the Hammer branch where it's converting
|
Something changed in the underlying vm factory. On master, I show Update: looks like we switched from |
Migrating to OSP over SSH transformation method with names containing international chars, such as
�Ää
, fails with :This PR escapes the characters for the URI bits that are not yet escaped.
Associated RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1669240