infochimps/cluster_chef — Issue #95: Using the cloud.keypair option breaks "knife cluster show", other discovery
Author: pcn
Created: 2012-01-12 21:17:49+00:00
State: open

I found that using cloud.keypair would let me specify the name of the keyfile in the way that I want (e.g. an ssh keypair named in ec2 named "foo" can now be used if I have ~/.ssh/foo.pem, or better yet ~/.ssh/id_foo which is what I use).

However, as soon as I use the keypair option, when a node is bootstrapped it can successfully launch, bootstrap, and wrap up, but subsequent knife cluster commands can't seem to find it.

I haven't found what defines "cluster" in cluster_chef. I'd assumed it was node attributes in nodes in an account, but it seems that the keypair plays a part as well?

I've been trying to figure out what's going on, but so far I haven't figured out where the key is:

```
Launching machines
CassandraPN-datanode-0: creating cloud server

+------------------------+------------+---------+----------+--------------+------------+-----------+------------+-----------------+---------+---------+
| Name | InstanceID | State | Flavor | Image | AZ | Public IP | Private IP | Created At | Volumes | Elastic |
+------------------------+------------+---------+----------+--------------+------------+-----------+------------+-----------------+---------+---------+
| CassandraPN-datanode-0 | i-3c7e245e | pending | t1.micro | ami-4b4ba522 | us-east-1d | | | 20120112-210955 | | |
+------------------------+------------+---------+----------+--------------+------------+-----------+------------+-----------------+---------+---------+
Waiting for servers:
0/1 | | 0:53 CassandraPN-datanode-0: Syncing to cloud
CassandraPN-datanode-0: labeling servers and volumes
CassandraPN-datanode-0: tagging CassandraPN-datanode-0 with {"name"=>"CassandraPN-datanode-0"}
1/1 |**************************************************| 0:54

+------------------------+------------+---------+----------+--------------+------------+--------------+--------------+-----------------+---------+----+
| Name | InstanceID | State | Flavor | Image | AZ | Public IP | Private IP | Created At | Volumes | Ela|
+------------------------+------------+---------+----------+--------------+------------+--------------+--------------+-----------------+---------+----+
| CassandraPN-datanode-0 | i-3c7e245e | running | t1.micro | ami-4b4ba522 | us-east-1d | 50.17.103.38 | 10.196.14.36 | 20120112-210955 | | |
+------------------------+------------+---------+----------+--------------+------------+--------------+--------------+-----------------+---------+----+
```

So it was crated, it is happy. Then (with some extra info printed out, part of my tracking this down):

```
847 pn@PN-mac 16:10 ~/dvcs/Knewton-chef-site-cookbooks $ knife cluster show CassandraPN
Inventorying servers in CassandraPN cluster, all facets, all servers
"Cluster's class is:"
[:facets, :undefined_servers, :cluster, :cluster_name, :cluster_role, :facet, :has_facet?, :find_facet, :servers, :slice, :to_s, :resolve!, :create_clus]
":CassandraPN, \"environment\"=>:_default @facets=>[\"datanode\"]}>"
"target.class is:"
ClusterChef::ServerSlice
""
+------------------------+-------+-------------+------------+-----------+------------+------------+--------+----+----------+
| Name | Chef? | State | InstanceID | Public IP | Private IP | Created At | Flavor | AZ | Env |
+------------------------+-------+-------------+------------+-----------+------------+------------+--------+----+----------+
| CassandraPN-datanode-0 | yes | not running | | | | | | | _default |
+------------------------+-------+-------------+------------+-----------+------------+------------+--------+----+----------+

```

It's gone, and there doesn't seem to be any indication as to why. If I launch with --bootstrap, then the node seems to have all appropriate ohai etc. info, but the show command provides the same info.

Trying to run other commands indicates that discovery is broken here, too:

```
848 pn@PN-mac 16:10 ~/dvcs/Knewton-chef-site-cookbooks $ knife cluster ssh CassandraPN 'ls'
Inventorying servers in CassandraPN cluster, all facets, all servers
"Cluster's class is:"
[:facets, :undefined_servers, :cluster, :cluster_name, :cluster_role, :facet, :has_facet?, :find_facet, :servers, :slice, :to_s, :resolve!, :create_clus]
":CassandraPN, \"environment\"=>:_default @facets=>[\"datanode\"]}>"
FATAL: No nodes returned from search!
```

Except for the two pull requests I've got, I don't think I've made any changes except for print statements relating to the keypair. Any help is appreciated on this, it's keeping me from being able to give cluster_chef to developers.

Commenting out the keypair clause in my cloud statement causes everything to work.

Thanks,

-Peter