Bug #12154
closedCannot create host via API using compute profile created in the UI.
Description
I've been trying to create DigitalOcean droplets using TheForeman's API, and have found what I'm pretty certain is a bug in the Compute Profile form.
The problem: The Compute Profile form uses the local database's image.id as the select value, where all other compute resources use image.uuid. This means that when saved, image_id in compute_attributes contains the local PostgreSQL database's image id, not the provider's UUID, which is used to identify the image to the Compute Resource provider. Needless to say, sending DO an ID that only exists in our local database doesn't work, and we get the message "This image does not belong to ...".
To fix the issue, :id needed changing to :uuid in app/views/compute_resources_vms/form/digitalocean/_base.html.erb on the image_selection line
This broke the UI, as it was unable to use image.uuid in the normal Host creation form. To fix it I added uuid to attr_accessor on app/models/concerns/fog_extensions/digitalocean/image.rb
This now appears to work for both UI and API host creation with Profiles.
Updated by Alex Shepherd about 9 years ago
Updated by Shlomi Zadok about 9 years ago
- Status changed from New to Ready For Testing
- Assignee set to Alex Shepherd
- Pull request https://github.com/theforeman/foreman-digitalocean/pull/9 added
- Pull request deleted (
)
Updated by Tommy McNeely about 9 years ago
Thanks Alex, can you fix your commit message as per the "standards" ... maybe something like
Fixes #12154 - use image.uuid instead of image.id to fix API host creation
~tommy
Updated by Alex Shepherd about 9 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset foreman-digitalocean|d4519974f765ce344c5f1cb8120da7afbd12ed81.