In your rubber.yml file, you get the following after you vulcanize:
key_name: gsg-keypair
key_file: "#{Dir[(File.expand_path('~') rescue '/root') + '/.ec2/*' + cloud_providers.aws.key_name].first}"
If for some reason your gsg-keypair is wrong, then the expression
above will produce the key_file "" (ie, blank string). This is b/c the
Dir[].first expression for an invalid or non-existant path produces
nil:
Dir['peace on earth'].first => nil
With no error checking this gets passed into the guts of Net::SSH,
where it throws out a completely opaque error message. True, somewhere
in the message, it is probably trying to complain about the blank file
name, but
- the file name is blank, so you can't see it.
- key_file wasn't blank to begin with, so you are looking for a
complaint about your key_file, not about nothing.
SSH complaints about nothing are the worst kind of errors to
debug ... :(
At a minimum, rubber should check for the existance of key_file early
on, and throw error message clearly pointing to that line in
rubber.yml as being the problem.
That would probably be enough, although I do wonder if the line
"#{Dir[(File.expand_path('~') rescue '/root') + '/.ec2/*' +
cloud_providers.aws.key_name].first}" might be changed like so:
"#{tmp=(File.expand_path('~') rescue '/root') + '/.ec2/*' +cloud_providers.aws.key_name;Dir[tmp].exist? ? Dir[tmp].first : tmp +" doesn't exist"}"
This might accomplish the same thing, athough it does seem less
elegant.
Thanks,
Rob.