petems / tugboat

A command line tool for interacting with your DigitalOcean droplets.
MIT License
1.45k stars 89 forks source link

`tugboat create` with options is not picking up default ssh key #234

Closed tribou closed 8 years ago

tribou commented 8 years ago

Tugboat 2.2.0

After new tugboat installation, I encountered this:

> tugboat create dev -s 4gb -i docker -r nyc3
Queueing creation of droplet 'dev'.../Users/user/.rvm/gems/ruby-2.2.1/gems/tugboat-2.2.0/lib/tugboat/middleware/create_droplet.rb:50:in `call': undefined method `split' for nil:NilClass (NoMethodError)

My ~/.tugboat file has the following entry (access_token redacted):

ssh:
  ssh_user: root
  ssh_key_path: "~/.ssh/id_rsa"
  ssh_port: '22'
defaults:
  region: nyc3
  image: dokku
  size: 512mb
  ssh_key: 1690771
  private_networking: 'false'
  backups_enabled: 'false'
  ip6: 'false'

However, when I manually specify the key with the -k ####### param, it works.

petems commented 8 years ago

Can you try with ssh_key: ['1690771']?

I think I need to fix up that logic because it assumes it's an array...

tribou commented 8 years ago

Now the error is this:

Queueing creation of droplet 'dev2'.../Users/user/.rvm/gems/ruby-2.2.1/gems/tugboat-2.2.0/lib/tugboat/middleware/create_droplet.rb:50:in `call': undefined method `split' for ["1690771"]:Array (NoMethodError)
petems commented 8 years ago

Hi @tribou!

Can you checkout this repo and try creating a droplet on the fix_ssh_key_array_from_config branch?

I think I've fixed it there, and added a PR to make the change and update the docs: #235, #236

After that I'll push out the update as Tugboat 2.2.1 (bugfix)

petems commented 8 years ago

This should be fixed in v2.2.1, can you check for me @tribou?

tribou commented 8 years ago

Here's what I found with v2.2.1:

ssh_key: 1234567      #fails
ssh_key: '1234567'    #works
ssh_key: ['1234567']  #works

I didn't go through the authorize process again, but I assume it populates one of the latter two ssh_key entries now?

petems commented 8 years ago

I need to double check the authorize process. But I should probably put in a to_s fix so people can user plain numbers...

petems commented 8 years ago

Fix for fixnum in https://github.com/pearkes/tugboat/pull/240

petems commented 8 years ago

Fix for authorize prompting to be given an array: https://github.com/pearkes/tugboat/pull/241