Project

General

Profile

Actions

Bug #12154

closed

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

Added by Alex Shepherd over 8 years ago. Updated over 8 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 #2

Updated by Shlomi Zadok over 8 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 ()
Actions #3

Updated by Tommy McNeely over 8 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

Actions #4

Updated by Alex Shepherd over 8 years ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF