From a5818b158f9ca52ff06f500e4bdc2e4c2379bd72 Mon Sep 17 00:00:00 2001 From: "James G. Kim" Date: Tue, 2 Jun 2015 18:38:27 +0900 Subject: [PATCH 1/2] Fixes 'unknown configuration key' errors for 'only' and 'except' --- template/parse.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/template/parse.go b/template/parse.go index a7b187f37..dbb29569d 100644 --- a/template/parse.go +++ b/template/parse.go @@ -134,6 +134,8 @@ func (r *rawTemplate) Template() (*Template, error) { } // Set the configuration + delete(c, "except") + delete(c, "only") delete(c, "keep_input_artifact") delete(c, "type") if len(c) > 0 { From d7c77895dcf0b415bb7018b0e5850603cf8879f7 Mon Sep 17 00:00:00 2001 From: "James G. Kim" Date: Fri, 5 Jun 2015 12:26:33 +0900 Subject: [PATCH 2/2] Add tests for only and except of post-processors --- template/parse_test.go | 34 +++++++++++++++++++++ template/test-fixtures/parse-pp-except.json | 8 +++++ template/test-fixtures/parse-pp-only.json | 8 +++++ 3 files changed, 50 insertions(+) create mode 100644 template/test-fixtures/parse-pp-except.json create mode 100644 template/test-fixtures/parse-pp-only.json diff --git a/template/parse_test.go b/template/parse_test.go index 46bb75ad8..9abca2f77 100644 --- a/template/parse_test.go +++ b/template/parse_test.go @@ -174,6 +174,40 @@ func TestParse(t *testing.T) { false, }, + { + "parse-pp-only.json", + &Template{ + PostProcessors: [][]*PostProcessor{ + []*PostProcessor{ + &PostProcessor{ + Type: "foo", + OnlyExcept: OnlyExcept{ + Only: []string{"bar"}, + }, + }, + }, + }, + }, + false, + }, + + { + "parse-pp-except.json", + &Template{ + PostProcessors: [][]*PostProcessor{ + []*PostProcessor{ + &PostProcessor{ + Type: "foo", + OnlyExcept: OnlyExcept{ + Except: []string{"bar"}, + }, + }, + }, + }, + }, + false, + }, + { "parse-pp-string.json", &Template{ diff --git a/template/test-fixtures/parse-pp-except.json b/template/test-fixtures/parse-pp-except.json new file mode 100644 index 000000000..dea70d3d3 --- /dev/null +++ b/template/test-fixtures/parse-pp-except.json @@ -0,0 +1,8 @@ +{ + "post-processors": [ + { + "type": "foo", + "except": ["bar"] + } + ] +} diff --git a/template/test-fixtures/parse-pp-only.json b/template/test-fixtures/parse-pp-only.json new file mode 100644 index 000000000..d2dbe07c6 --- /dev/null +++ b/template/test-fixtures/parse-pp-only.json @@ -0,0 +1,8 @@ +{ + "post-processors": [ + { + "type": "foo", + "only": ["bar"] + } + ] +}