From ecf66ad7b54e50379b4e670b8b233ad2bc548d42 Mon Sep 17 00:00:00 2001 From: Jack Pearkes Date: Sun, 2 Nov 2014 14:48:40 -0800 Subject: [PATCH] providers/digitalocean: compat for changes to API for droplet size Upstream in the digitalocean API, the size slug became a size string, breaking pearkes/digitalocean. https://github.com/pearkes/digitalocean/pull/1 This fixes compatibility for changes to that library. closes #510 --- .../digitalocean/resource_digitalocean_droplet.go | 2 +- .../resource_digitalocean_droplet_test.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/builtin/providers/digitalocean/resource_digitalocean_droplet.go b/builtin/providers/digitalocean/resource_digitalocean_droplet.go index 712f94a82f..9c19656696 100644 --- a/builtin/providers/digitalocean/resource_digitalocean_droplet.go +++ b/builtin/providers/digitalocean/resource_digitalocean_droplet.go @@ -296,7 +296,7 @@ func resource_digitalocean_droplet_update_state( s.Attributes["ipv4_address_private"] = droplet.IPV4Address("private") } - s.Attributes["size"] = droplet.SizeSlug() + s.Attributes["size"] = droplet.SizeSlug s.Attributes["status"] = droplet.Status return s, nil diff --git a/builtin/providers/digitalocean/resource_digitalocean_droplet_test.go b/builtin/providers/digitalocean/resource_digitalocean_droplet_test.go index 12d8a362e5..6666576dd3 100644 --- a/builtin/providers/digitalocean/resource_digitalocean_droplet_test.go +++ b/builtin/providers/digitalocean/resource_digitalocean_droplet_test.go @@ -123,8 +123,8 @@ func testAccCheckDigitalOceanDropletAttributes(droplet *digitalocean.Droplet) re return fmt.Errorf("Bad image_slug: %s", droplet.ImageSlug()) } - if droplet.SizeSlug() != "512mb" { - return fmt.Errorf("Bad size_slug: %s", droplet.SizeSlug()) + if droplet.SizeSlug != "512mb" { + return fmt.Errorf("Bad size_slug: %s", droplet.SizeSlug) } if droplet.RegionSlug() != "nyc3" { @@ -141,8 +141,8 @@ func testAccCheckDigitalOceanDropletAttributes(droplet *digitalocean.Droplet) re func testAccCheckDigitalOceanDropletRenamedAndResized(droplet *digitalocean.Droplet) resource.TestCheckFunc { return func(s *terraform.State) error { - if droplet.SizeSlug() != "1gb" { - return fmt.Errorf("Bad size_slug: %s", droplet.SizeSlug()) + if droplet.SizeSlug != "1gb" { + return fmt.Errorf("Bad size_slug: %s", droplet.SizeSlug) } if droplet.Name != "baz" { @@ -160,8 +160,8 @@ func testAccCheckDigitalOceanDropletAttributes_PrivateNetworkingIpv6(droplet *di return fmt.Errorf("Bad image_slug: %s", droplet.ImageSlug()) } - if droplet.SizeSlug() != "1gb" { - return fmt.Errorf("Bad size_slug: %s", droplet.SizeSlug()) + if droplet.SizeSlug != "1gb" { + return fmt.Errorf("Bad size_slug: %s", droplet.SizeSlug) } if droplet.RegionSlug() != "sgp1" {