infochimps-labs/ironfan — pull request #240 by gwilton (2013-01-11 21:12:08+00:00)
Title: Fixing issue #236

The "cluster ssh" command was broken for VPC instances, this will fix a few bugs.

**lib/chef/knife/cluster_ssh.rb:54**

If vpc_id is set lets use the public_ip_address instead of public_hostname

**lib/chef/knife/cluster_ssh.rb:52**

Note sure why this is commented out or why target nolonger has a chef_nodes associated with it. I think is change in architecture. However, the instance variable @action_nodes ends up being nil and collides with chef in lib/chef/knife/ssh.rb:125. It can also be that i am trying to do cluster ssh to an instances that has not yet been bootstrapped. Setting ```ruby @action_nodes = [] ``` fixed then following error.

[homebase (master)]$ bundle exec knife cluster ssh sandbox uptime -VV
Inventorying servers in sandbox cluster, all facets, all servers
sandbox:	Loading chef
sandbox:	Loading ec2
sandbox:	Reconciling DSL and provider information
ERROR: knife encountered an unexpected error
This may be a bug in the 'cluster ssh' knife command or plugin
Please collect the output of this command with the `-VV` option before filing a bug report.
**Exception: NoMethodError: undefined method `each' for nil:NilClass**

**Then I got the following Warning after fixing the above issues.**

[homebase (master)]$ bundle exec knife cluster ssh sandbox uptime -VV
Inventorying servers in sandbox cluster, all facets, all servers
sandbox:	Loading chef
sandbox:	Loading ec2
sandbox:	Reconciling DSL and provider information
**WARNING: Failed to connect to -- Net::SSH::AuthenticationFailed: ubuntu@107.23.163.84**

I managed to get through this by using the -i option. So it seems the client key is not being set properly. I hacked this by adding ```ruby config[:identity_file] ||= target.map {|c| c.keypair.key_filename }.compact.first ``` to ```ruby configure_session ```

This branch is working for me and submitting this pull request, let me know if I failed to understand some fundamentals here. I enjoy working with Ironfan and currently have a need to integrate it with VPC in AWS. Thanks.