opscode/chef — pull request #1530 by btm (2014-06-20 21:35:34+00:00)
Title: CHEF-5158: Prefer CLI argument over configuration file setting for ssh_attribute

Builds slightly on #1379 by changing an internal attribute name to something more specific and self-explanatory. Also adds debug messages regarding which was chosen.

Manual testing:

Correctly uses node[:cloud][:public_hostname] if it exists:
```
$ knife ssh name:i-5f4cf274 -x ubuntu hostname
ec2-107-20-12-157.compute-1.amazonaws.com domU-12-31-39-06-C1-62
```

But lets you override that on the command line (expected to fail here):
```
$ knife ssh name:i-5f4cf274 -a ipaddress -x ubuntu hostname
WARNING: Failed to connect to 10.208.198.144 -- Net::SSH::ConnectionTimeout: execution expired for 10.208.198.144
```

knife.rb contains this, which means we are correctly taking the CLI argument and using node[:cloud][:public_hostname] over the configuration file in both examples above --^
```
knife[:ssh_attribute] = "ipaddress"
```

Off the cloud, the above config is read correctly when no command line is specified:
```
$ knife ssh name:btm-mbp-dev.foo.org hostname
172.16.151.100 btm-mbp-dev
```

Otherwise it correctly defaults to fqdn:
```
$ knife ssh name:btm-mbp-dev.foo.org hostname
btm-mbp-dev.foo.org btm-mbp-dev
```