Bug #10109
openUnable to create hosts after upgrading - undefined method `name' for nil:NilClass
Description
Log Entry: Failed to create a compute MyDO (DigitalOcean) instance newhost.domain.com: undefined method `name' for nil:NilClass
If you have upgraded the DigitalOcean plugin to 0.1.0 after creating your Compute Resource, it will not have the appropriate SSH Key associated with it, and will fail. This is a bug because it should more "gracefully" detect this and generate the key. This could also potentially be a problem if the key was removed from Digital Ocean by someone in the WebUI. (not confirmed) See below for workaround...
Backtrace:
```
Failed to create a compute MyDO (DigitalOcean) instance pla-devapp-01.do.lark-it.com: undefined method `name' for nil:NilClass
/opt/rh/ruby193/root/usr/share/gems/gems/foreman_digitalocean-0.1.0/app/models/foreman_digitalocean/digitalocean.rb:137:in `block in ssh_key'
/opt/rh/ruby193/root/usr/share/gems/gems/foreman_digitalocean-0.1.0/app/models/foreman_digitalocean/digitalocean.rb:137:in `select'
/opt/rh/ruby193/root/usr/share/gems/gems/foreman_digitalocean-0.1.0/app/models/foreman_digitalocean/digitalocean.rb:137:in `ssh_key'
/opt/rh/ruby193/root/usr/share/gems/gems/foreman_digitalocean-0.1.0/app/models/foreman_digitalocean/digitalocean.rb:39:in `create_vm'
/usr/share/foreman/app/models/concerns/orchestration/compute.rb:74:in `setCompute'
/usr/share/foreman/app/models/concerns/orchestration.rb:137:in `execute'
/usr/share/foreman/app/models/concerns/orchestration.rb:85:in `block in process'
/usr/share/foreman/app/models/concerns/orchestration.rb:77:in `each'
/usr/share/foreman/app/models/concerns/orchestration.rb:77:in `process'
/usr/share/foreman/app/models/concerns/orchestration.rb:18:in `on_save'
```
Updated by Tommy McNeely over 9 years ago
Workaround¶
The workaround is simple, but labor intensive. You need to delete the compute resource and create a new one. The SSH Key is created at the time the compute resource is created.
Updated by Daniel Lobato Garcia over 9 years ago
Perhaps you want it to regenerate the SSH key in this event, or add this info to the README?