digitalocean / droplet_kit

DropletKit is the official DigitalOcean API client for Ruby.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VPC attribute addition causes droplet creation to return non-specific failure

nkanderson opened this issue · comments

It looks like the addition of the vpc_uuid attribute and mapping for droplets created a breaking change between versions 2.9 & 3. Without inclusion of this key, calling client.droplets.create(droplet) returns DropletKit::Error with "msg": "500: {"id": "internal_server_error", "message": "Server was unable to give you a response." }".

e.g. something like

droplet = DropletKit::Droplet.new(
      name: "#{name}",
      region: "#{region}",
      size: 's-1vcpu-1gb',
      image: 'centos-7-x64',
      ssh_keys: ["#{ssh_fingerprint}"],
      ipv6: true,
      tags: ['web'],
)
resp = client.droplets.create(droplet)

works with v2.9. In v3, the droplet is required to have the vpc_uuid key, with (I think) a string value.

Performing the equivalent requests with curl result in successful droplet creation, so it seems like something should be adjusted with how droplet_kit is handling this attribute.

I'd be up for taking a crack at a PR if anyone wants to provide guidance on the intended behavior. It seems like at the least, if vpc_uuid is required, its absence should return DropletKit::FailedCreate, "msg": "You specified invalid VPC parameters for Droplet creation." But since curl requests are succeeding without the key, maybe there is different preferred handling?

@nkanderson thank you for reporting this issue. I will take a look at it and will get back to you as soon as I have more info.

@nkanderson we identified the issue, it was farther down in the stack. The fix is already in place, no changes should be needed for the droplet_kit 3.0.0 version. Can you please verify if it's all good on your end?
Again, thank you for reporting this issue to us and we're sorry for any inconvenience this may have caused you.

Cool, thanks @viola, my code looks to be working with v3 of droplet_kit now :)

Out of curiosity, are you able to point me to the PR where the issue was fixed, if it's a public repo? I'd be interested to see what the cause was, if it's open to take a look at.

@nkanderson thank you for letting me know all is good on your end. The issue was fixed in private repo and in the gist the bug was related to handling vpc_uuid with nil "vpc_uuid":null and this was reproducible with curl as it was with droplet_kit => v3.