From 3b8f3c5a8bdaad6e6d5c2a26ab9198c574a82bf1 Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Mon, 16 Sep 2019 16:30:29 +0200 Subject: [PATCH] remove any reference to Push --- packer/core.go | 5 ---- packer/core_test.go | 34 -------------------------- template/parse.go | 11 --------- template/parse_test.go | 12 --------- template/template.go | 10 -------- template/test-fixtures/parse-push.json | 5 ---- 6 files changed, 77 deletions(-) delete mode 100644 template/test-fixtures/parse-push.json diff --git a/packer/core.go b/packer/core.go index c9672eb96..3e9895dcb 100644 --- a/packer/core.go +++ b/packer/core.go @@ -398,10 +398,5 @@ func (c *Core) init() error { c.secrets = append(c.secrets, secret) } - // Interpolate the push configuration - if _, err := interpolate.RenderInterface(&c.Template.Push, c.Context()); err != nil { - return fmt.Errorf("Error interpolating 'push': %s", err) - } - return nil } diff --git a/packer/core_test.go b/packer/core_test.go index e1ffa5b59..6df55a47a 100644 --- a/packer/core_test.go +++ b/packer/core_test.go @@ -427,40 +427,6 @@ func TestCoreBuild_templatePath(t *testing.T) { } } -func TestCore_pushInterpolate(t *testing.T) { - cases := []struct { - File string - Vars map[string]string - Result template.Push - }{ - { - "push-vars.json", - map[string]string{"foo": "bar"}, - template.Push{Name: "bar"}, - }, - } - - for _, tc := range cases { - tpl, err := template.ParseFile(fixtureDir(tc.File)) - if err != nil { - t.Fatalf("err: %s\n\n%s", tc.File, err) - } - - core, err := NewCore(&CoreConfig{ - Template: tpl, - Variables: tc.Vars, - }) - if err != nil { - t.Fatalf("err: %s\n\n%s", tc.File, err) - } - - expected := core.Template.Push - if !reflect.DeepEqual(expected, tc.Result) { - t.Fatalf("err: %s\n\n%#v", tc.File, expected) - } - } -} - func TestCoreValidate(t *testing.T) { cases := []struct { File string diff --git a/template/parse.go b/template/parse.go index 82bf6731f..cd4467b8f 100644 --- a/template/parse.go +++ b/template/parse.go @@ -242,17 +242,6 @@ func (r *rawTemplate) Template() (*Template, error) { result.Provisioners = append(result.Provisioners, &p) } - // Push - if len(r.Push) > 0 { - var p Push - if err := r.decoder(&p, nil).Decode(r.Push); err != nil { - errs = multierror.Append(errs, fmt.Errorf( - "push: %s", err)) - } - - result.Push = p - } - // If we have errors, return those with a nil result if errs != nil { return nil, errs diff --git a/template/parse_test.go b/template/parse_test.go index 71d152af6..77b63616d 100644 --- a/template/parse_test.go +++ b/template/parse_test.go @@ -358,15 +358,6 @@ func TestParse(t *testing.T) { false, }, - { - "parse-push.json", - &Template{ - Push: Push{ - Name: "foo", - }, - }, - false, - }, { "parse-comment.json", &Template{ @@ -480,9 +471,6 @@ func TestParse(t *testing.T) { }, }, }, - Push: Push{ - Name: "push test", - }, }, false, }, diff --git a/template/template.go b/template/template.go index 43d7de078..6013313de 100644 --- a/template/template.go +++ b/template/template.go @@ -25,7 +25,6 @@ type Template struct { Builders map[string]*Builder Provisioners []*Provisioner PostProcessors [][]*PostProcessor - Push Push // RawContents is just the raw data for this template RawContents []byte @@ -66,15 +65,6 @@ func (t *Template) Raw() (*rawTemplate, error) { out.Variables[k] = v } - if t.Push.Name != "" { - b, _ := json.Marshal(t.Push) - - var m map[string]interface{} - _ = json.Unmarshal(b, &m) - - out.Push = m - } - return &out, nil } diff --git a/template/test-fixtures/parse-push.json b/template/test-fixtures/parse-push.json deleted file mode 100644 index 2529eedc4..000000000 --- a/template/test-fixtures/parse-push.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "push": { - "name": "foo" - } -}