From d36b653d3fc56157a9f3e42de71bae008762363e Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Tue, 6 Oct 2015 10:52:47 -0400 Subject: [PATCH] Make DigitalOcean artifact ID match AWS format The Vagrant post processor expects the DO artifact ID to look like an AWS artifact ID (region_id:snapshot_id). This commit makes the DO artifact Id() function output this format. --- builder/digitalocean/artifact.go | 2 +- builder/digitalocean/artifact_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builder/digitalocean/artifact.go b/builder/digitalocean/artifact.go index 3b6a05e53..6abb561c9 100644 --- a/builder/digitalocean/artifact.go +++ b/builder/digitalocean/artifact.go @@ -32,7 +32,7 @@ func (*Artifact) Files() []string { } func (a *Artifact) Id() string { - return strconv.FormatUint(uint64(a.snapshotId), 10) + return fmt.Sprintf("%s:%s", a.regionName, strconv.FormatUint(uint64(a.snapshotId), 10)) } func (a *Artifact) String() string { diff --git a/builder/digitalocean/artifact_test.go b/builder/digitalocean/artifact_test.go index 4492c7bf3..7ea586111 100644 --- a/builder/digitalocean/artifact_test.go +++ b/builder/digitalocean/artifact_test.go @@ -16,7 +16,7 @@ func TestArtifact_Impl(t *testing.T) { func TestArtifactId(t *testing.T) { a := &Artifact{"packer-foobar", 42, "San Francisco", nil} - expected := "42" + expected := "San Francisco:42" if a.Id() != expected { t.Fatalf("artifact ID should match: %v", expected)