From b5f1fd1423ff5d543e907ecf0d1b167eec43f8ae Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 27 Dec 2013 09:52:40 -0700 Subject: [PATCH] packer: delete pause_before to avoid template invalids [GH-759] --- packer/template.go | 4 ++++ packer/template_test.go | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/packer/template.go b/packer/template.go index aadaf4511..4a3170427 100644 --- a/packer/template.go +++ b/packer/template.go @@ -317,6 +317,10 @@ func ParseTemplate(data []byte, vars map[string]string) (t *Template, err error) raw.pauseBefore = duration } + // Remove the pause_before setting if it is there so that we don't + // get template validation errors later. + delete(v, "pause_before") + raw.RawConfig = v } diff --git a/packer/template_test.go b/packer/template_test.go index 38412c790..2d17bb3e7 100644 --- a/packer/template_test.go +++ b/packer/template_test.go @@ -1479,6 +1479,11 @@ func TestTemplateBuild_ProvisionerPauseBefore(t *testing.T) { t.Fatalf("bad: %#v", pp.PauseBefore) } } + + config := coreBuild.provisioners[0].config[0].(map[string]interface{}) + if _, ok := config["pause_before"]; ok { + t.Fatal("pause_before should be removed") + } } func TestTemplateBuild_variables(t *testing.T) {