Project

General

Profile

Actions

Bug #12154

closed

Cannot create host via API using compute profile created in the UI.

Added by Alex Shepherd about 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Difficulty:
trivial
Triaged:
Fixed in Releases:
Found in Releases:

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.

Actions

Also available in: Atom PDF