Browse Source

fix: -var-file option to match terraform command format

update-packer-186
Bo-Yi Wu 7 years ago
parent
commit
6f55358146
  1. 4
      plugin.go
  2. 4
      plugin_test.go

4
plugin.go

@ -39,7 +39,7 @@ func pkValidate(config Config) *exec.Cmd {
} }
for _, v := range config.VarFiles { for _, v := range config.VarFiles {
args = append(args, "-var-file", fmt.Sprintf("%s", v)) args = append(args, fmt.Sprintf("-var-file=%s", v))
} }
for k, v := range config.Vars { for k, v := range config.Vars {
@ -72,7 +72,7 @@ func pkBuild(config Config) *exec.Cmd {
} }
for _, v := range config.VarFiles { for _, v := range config.VarFiles {
args = append(args, "-var-file", fmt.Sprintf("%s", v)) args = append(args, fmt.Sprintf("-var-file=%s", v))
} }
for k, v := range config.Vars { for k, v := range config.Vars {

4
plugin_test.go

@ -35,7 +35,7 @@ func Test_pkValidate(t *testing.T) {
VarFiles: []string{"bar.json"}, VarFiles: []string{"bar.json"},
}, },
}, },
want: exec.Command("packer", "validate", "-var-file", "bar.json", "-var", "foo=bar", "foo.json"), want: exec.Command("packer", "validate", "-var-file=bar.json", "-var", "foo=bar", "foo.json"),
}, },
{ {
name: "add except only color flag", name: "add except only color flag",
@ -89,7 +89,7 @@ func Test_pkBuild(t *testing.T) {
VarFiles: []string{"bar.json"}, VarFiles: []string{"bar.json"},
}, },
}, },
want: exec.Command("packer", "build", "-var-file", "bar.json", "-var", "foo=bar", "foo.json"), want: exec.Command("packer", "build", "-var-file=bar.json", "-var", "foo=bar", "foo.json"),
}, },
{ {
name: "add Parallel, Color and debug flag", name: "add Parallel, Color and debug flag",

Loading…
Cancel
Save