Skip to content

Commit

Permalink
Merge pull request #19194 from fdupont-redhat/v2v_remove_py_extension…
Browse files Browse the repository at this point in the history
…_of_wrapper

[V2V] Remove .py extension from calls to virt-v2v-wrapper
  • Loading branch information
agrare committed Aug 23, 2019
2 parents 4d75fc2 + f1ac37c commit f2ea41c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/models/conversion_host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def apply_task_limits(path, limits = {})
raise "Could not apply the limits in '#{path}' on '#{resource.name}' with [#{err.class}: #{err}]"
end

# Run the virt-v2v-wrapper.py script on the remote host and return a hash
# Run the virt-v2v-wrapper script on the remote host and return a hash
# result from the parsed JSON output.
#
# Certain sensitive fields are filtered in the error messages to prevent
Expand All @@ -167,12 +167,12 @@ def apply_task_limits(path, limits = {})
def run_conversion(conversion_options)
ignore = %w[password fingerprint key]
filtered_options = conversion_options.clone.tap { |h| h.each { |k, _v| h[k] = "__FILTERED__" if ignore.any? { |i| k.to_s.end_with?(i) } } }
result = connect_ssh { |ssu| ssu.shell_exec('/usr/bin/virt-v2v-wrapper.py', nil, nil, conversion_options.to_json) }
result = connect_ssh { |ssu| ssu.shell_exec('/usr/bin/virt-v2v-wrapper', nil, nil, conversion_options.to_json) }
JSON.parse(result)
rescue MiqException::MiqInvalidCredentialsError, MiqException::MiqSshUtilHostKeyMismatch => err
raise "Failed to connect and run conversion using options #{filtered_options} with [#{err.class}: #{err}]"
rescue JSON::ParserError
raise "Could not parse result data after running virt-v2v-wrapper.py using options: #{filtered_options}. Result was: #{result}."
raise "Could not parse result data after running virt-v2v-wrapper using options: #{filtered_options}. Result was: #{result}."
rescue StandardError => err
raise "Starting conversion failed on '#{resource.name}' with [#{err.class}: #{err}]"
end
Expand Down
2 changes: 1 addition & 1 deletion spec/models/conversion_host_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@

it "works as expected if the connection is successful but the JSON is invalid" do
allow(conversion_host).to receive(:connect_ssh).and_return('bogus')
expected_message = "Could not parse result data after running virt-v2v-wrapper.py using "\
expected_message = "Could not parse result data after running virt-v2v-wrapper using "\
"options: #{filtered_options}. Result was: bogus."
expect { conversion_host.run_conversion(conversion_options) }.to raise_error(expected_message)
end
Expand Down

0 comments on commit f2ea41c

Please sign in to comment.