Project

General

Profile

Bug #11332

Version 1 of the API is deprecated and will be shutdown on November 1st 2015

Added by Rolf Larsen over 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Urgent
Assignee:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

foreman-digitalocean still using v1 api via Fog?

https://developers.digitalocean.com/documentation/v1/


Related issues

Has duplicate Foreman - Bug #12250: Digital Ocean API v1 Sunsetting November 9, 2015Duplicate2015-10-22
Blocked by Foreman - Refactor #12494: Update fog to 1.36.0Closed2015-11-16

Associated revisions

Revision ab3d6fb4 (diff)
Added by Daniel Lobato Garcia over 3 years ago

Fixes #11332 - DigitalOcean API v2 support

This should allow provisioning using API v2. It relies on Fog 1.36 at
least to work, so 1.10 and older versions of Foreman will not work with
this plugin unfortunately.

The plugin now:
  • Uses slug instead of id for image, region and flavor (size)
  • Uses .delete instead of .destroy to destroy the droplet on DO
  • Just requests the API key when creating the compute resource, not the
    client_id
  • Has a few simple tests for the compute resource & enhances the Jenkins
    task

History

#1 Updated by Dominic Cleal about 4 years ago

#2 Updated by Dominic Cleal about 4 years ago

I think the new Fog v1.35.0 (and v2, when released) support DO's v2 API, though there's another issue noted on #11729 about v1.35.0.

#3 Updated by Dominic Cleal about 4 years ago

  • Has duplicate Bug #12250: Digital Ocean API v1 Sunsetting November 9, 2015 added

#4 Updated by Alex Shepherd about 4 years ago

This is now deprecated at DigitalOcean's end, so we are now completely unable to use Foreman to directly provision DigitalOcean machines. Is there a timeline, or list of tasks that need completing in order to get this back up and running? It's relatively critical for our business, and I can't find any kind of timescale.

#5 Updated by Dominic Cleal about 4 years ago

It's pretty bleak. The version of Fog that added some DO 2.0 support (1.35.0) also broke Ruby 1.9.3 compatibility, so we can't use it without either:

a) dropping 1.9.3 support (ticket #8884), which means providing solutions for the three Debian & Ubuntu OSes affected (EL's in progress via #7228)
b) Fog issuing a further 1.x update with the 1.9.3 support fixed (around the fog-google dependency). https://github.com/fog/fog/issues/3711 might be the best place to request that.

We can also update to Fog 2.0.0 when it's released, but that will also require us dropping 1.9.3 support. This needs to be done sooner than later, though a Fog update may be quicker.

#6 Updated by Dominic Cleal about 4 years ago

#7 Updated by Dominic Cleal about 4 years ago

#8 Updated by Dominic Cleal about 4 years ago

Dominic Cleal wrote:

b) Fog issuing a further 1.x update with the 1.9.3 support fixed (around the fog-google dependency). https://github.com/fog/fog/issues/3711 might be the best place to request that.

This happened, #12494 tracks updating Foreman. We'd normally only put this into a new major release, but I guess we'll have to test it and see about including it in 1.10.1 to fix this issue.

#9 Updated by Tommy McNeely about 4 years ago

Fog released 1.36 Monday morning, so we should be able to do this now, right?

#10 Updated by Dominic Cleal about 4 years ago

Tommy McNeely wrote:

Fog released 1.36 Monday morning, so we should be able to do this now, right?

Yes, 1.36.0 is in develop now, Debian nightlies but not RPM nightlies yet. Adding :version => :v2 to the client method (next to :provider) in the digitalocean.rb model should cause it to use the V2 API. After that it just needs testing.

#11 Updated by Tommy McNeely about 4 years ago

I have been working on it... https://github.com/theforeman/foreman-digitalocean/compare/master...TJM:11332-apiv2?expand=1 ... but it requires pretty significant changes.

Things I have found, so far ...
  • The version => 'v2' and no "username" .. the "password" is now `digitalocean_token` (easy stuff)
  • some other methods are renamed such as destroy_ssh_key -> delete_ssh_key (which I like better anyhow)
  • flavor is now size (this has caused some issues, I can't decide whether to change all the views or have a fog_extension)
  • region and "size" now uses "slug" instead of "id" (there is no regions.get, that needs to be regions.find { ... }
  • There is no longer an "id" mapping between objects, such as a server having a (region_id, flavor_id) that maps back to a regions.get(id), region and size are just a hash directly in the server object, which makes it somewhat easier and somewhat harder.
    • The only thing that I don't like so far is that I have a "nicer" name field for the image name, but because image is a hash directly in the server object, it may not have my enhancements
  • vm.state (client.servers.first.state) doesn't exist, had to add a fog_extension for that too

There are actually several cases where I feel like my "fog_extensions" should actually just be PRs to fog :)

#12 Updated by Daniel Lobato Garcia almost 4 years ago

For the record, I nearly have this working now. It required a few changes to support the v2 API - I got it to just to create the droplet so far.

Deleting it doesn't work, I have to check what's the issue, and SSHing the provision script isn't possible either, as the Orchestration::Compute stuff
is trying to run 'Host.find_by_ip' which returns undefined method (find_by_ip).

Host.find_by_ip should be available AFAIK - so maybe that last point is a bug common to all compute resources with SSH provisioning.

#13 Updated by Daniel Lobato Garcia almost 4 years ago

  • Priority changed from Normal to Urgent

Raising priority as this effectively blocks anyone from using the plugin until fixed.

#14 Updated by Dominic Cleal almost 4 years ago

Daniel Lobato Garcia wrote:

Deleting it doesn't work, I have to check what's the issue, and SSHing the provision script isn't possible either, as the Orchestration::Compute stuff
is trying to run 'Host.find_by_ip' which returns undefined method (find_by_ip).

Host.find_by_ip should be available AFAIK - so maybe that last point is a bug common to all compute resources with SSH provisioning.

It was removed, but Foreman core still attempts to use it - see #13084 (unfixed).

#15 Updated by Daniel Lobato Garcia over 3 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF