Cannot create host via API using compute profile created in the UI.
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.
#1 Updated by Alex Shepherd about 6 years ago
#4 Updated by Alex Shepherd almost 6 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset foreman-digitalocean|d4519974f765ce344c5f1cb8120da7afbd12ed81.