Skip to content

Error if Host and HostName don't match in ssh_config #93

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

Closed
fossil12 opened this issue Oct 3, 2017 · 1 comment
Closed

Error if Host and HostName don't match in ssh_config #93

fossil12 opened this issue Oct 3, 2017 · 1 comment
Labels

Comments

@fossil12
Copy link

fossil12 commented Oct 3, 2017

Steps to reproduce

  1. Add a Host entry in your ssh_config:
Host your-server
    HostName 10.0.2.4
  1. Run the following code:
hosts = ['your-server']
client = ParallelSSHClient(hosts)
client.run_command('ls')

Expected result

The command is executed on "your-server" at 10.0.2.4 like in the first usage example.

Actual result

A KeyError: '10.0.2.4' is raised.

Traceback (most recent call last):
  File "./test.py", line 11, in <module>
    output = client.run_command('ls')
  File "pssh/pssh_client.py", line 689, in run_command
    self.get_output(cmd, output, encoding=encoding)
  File "pssh/pssh_client.py", line 778, in get_output
    stdout = self.host_clients[host].read_output_buffer(
KeyError: '10.0.2.4'

My research showed that this is due to the fact that ParallelSSHClient stores the SSHClient at key your-server, but the hostname returned by SSHClient is 10.0.2.4.

I'm not so sure how to fix this, thus I'm filing it here.

@pkittenis pkittenis added the bug label Oct 4, 2017
pkittenis pushed a commit that referenced this issue Oct 4, 2017
@pkittenis
Copy link
Member

Thanks for the report and the reproducible test.

pkittenis pushed a commit that referenced this issue Oct 4, 2017
…r for host in parallel client plus test. Resolves #93
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants