-
Notifications
You must be signed in to change notification settings - Fork 897
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
Conversion Host - Try hostname for SSH and fix MiqSshUtil args #18103
Conversion Host - Try hostname for SSH and fix MiqSshUtil args #18103
Conversation
app/models/conversion_host.rb
Outdated
@@ -34,6 +34,7 @@ def source_transport_method | |||
end | |||
|
|||
def ipaddress(family = 'ipv4') | |||
return resource.hostname if resource.hostname |
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.
Hm I wouldn't expect an ipaddress method to return a dns hostname, maybe another method that tries hostname then ipaddress?
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.
I've added a delegation for hostname
and updated miq_ssh_util_args
to use it if present.
@@ -121,7 +122,7 @@ def check_resource_credentials_openstack | |||
|
|||
def connect_ssh | |||
require 'MiqSshUtil' | |||
MiqSshUtil.shell_with_su(miq_ssh_util_args) do |ssu, _shell| | |||
MiqSshUtil.shell_with_su(*miq_ssh_util_args) do |ssu, _shell| |
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.
Oops ;)
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 looks nicer
Checked commits fabiendupont/manageiq@c1c93cd~...1de3f2d with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
…e_as_ipaddress Conversion Host - Try hostname for SSH and fix MiqSshUtil args (cherry picked from commit 84a80a0) https://bugzilla.redhat.com/show_bug.cgi?id=1634029
Hammer backport details:
|
The IP addresses of a virtual machine or a host are not ordered accordingly to their interface name or role. So, when trying to connect to a conversion host, the IP address might not be correct. Returning the hostname when it's available mimics the behavior of Host.connect_ssh method.
This PR also fixes the parameters for
MiqSshUtil.shell_with_su
by passing the array correctly.Associated RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1634029