diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cc95e4fd..cf62f1129 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ BUG FIXES: * builder/all: timeout waiting for SSH connection is a failure. [GH-491] +* builder/digitalocean: don't panic if erroneous API response doesn't + contain error message. [GH-492] * builder/virtualbox: error if VirtualBox version cant be detected. [GH-488] * builder/virtualbox: detect if vboxdrv isn't properly setup. [GH-488] diff --git a/builder/digitalocean/api.go b/builder/digitalocean/api.go index 7e09595cc..b22c1bb4d 100644 --- a/builder/digitalocean/api.go +++ b/builder/digitalocean/api.go @@ -227,7 +227,13 @@ func NewRequest(d DigitalOceanClient, path string, params url.Values) (map[strin } if status == "ERROR" { - status = decodedResponse["message"].(string) + statusRaw, ok := decodedResponse["message"] + if ok { + status = statusRaw.(string) + } else { + status = fmt.Sprintf( + "Unknown error. Full response body: %s", body) + } } lastErr = errors.New(fmt.Sprintf("Received error from DigitalOcean (%d): %s",