Fabric: DNS issues with HostName in SSH config

Created on 16 Apr 2012  ·  5Comments  ·  Source: fabric/fabric

Very simple scenario:

env.use_ssh_config = True

@hosts(['example'])
def test():
    run('uname')

and with the following SSH config:

Host example
  HostName example.com

I'm getting this:

$ fab test
[example] Executing task 'test'
[example] run: uname

Fatal error: Name lookup failed for example.com 

Underlying exception:
    nodename nor servname provided, or not known

Aborting.

# BUT!

$ ssh example uname
Linux

Any idea what's going on?

Most helpful comment

Got bitten by the extra whitespace bug too, posting this here for future searchers:
The error I was getting was Fatal error: Name lookup failed for hosts - since we were using the dictionary-based env.roledefs definition.

All 5 comments

I just found out I had HostName example.com_ (underscore is an accidental trailing whitespace) in the SSH config.

Looks like #305 all over again?

I think this needs to be done on the ssh side since the actual matching of input (Fabric asking for host "example") with the ssh config key, which is what needs stripping ("example ") is performed in SSHConfig.lookup. I'll make a reference there.

See ssh #23

Thanks @yuvadm - extra space got me too

Got bitten by the extra whitespace bug too, posting this here for future searchers:
The error I was getting was Fatal error: Name lookup failed for hosts - since we were using the dictionary-based env.roledefs definition.

Was this page helpful?
0 / 5 - 0 ratings