Browse Source

fix: add syntax only flag

update-packer-186
Bo-Yi Wu 7 years ago
parent
commit
b6a8901ebb
  1. 18
      main.go
  2. 1
      plugin.go

18
main.go

@ -50,6 +50,11 @@ func main() {
Usage: "Will execute multiple builds in parallel as defined in the template", Usage: "Will execute multiple builds in parallel as defined in the template",
EnvVar: "PLUGIN_TEMPLATE", EnvVar: "PLUGIN_TEMPLATE",
}, },
cli.BoolFlag{
Name: "syntax_only",
Usage: "Only check syntax. Do not verify config of the template",
EnvVar: "PLUGIN_SYNTAX_ONLY",
},
} }
app.Version = Version app.Version = Version
@ -83,12 +88,13 @@ func run(c *cli.Context) error {
plugin := Plugin{ plugin := Plugin{
Config: Config{ Config: Config{
Actions: c.StringSlice("actions"), Actions: c.StringSlice("actions"),
Vars: vars, Vars: vars,
Template: c.String("template"), Template: c.String("template"),
VarFiles: c.StringSlice("var_files"), VarFiles: c.StringSlice("var_files"),
Except: c.StringSlice("except"), Except: c.StringSlice("except"),
Only: c.StringSlice("only"), Only: c.StringSlice("only"),
SyntaxOnly: c.Bool("syntax_only"),
}, },
} }

1
plugin.go

@ -74,7 +74,6 @@ func (p *Plugin) Exec() error {
commands = append(commands, exec.Command("packer", "version")) commands = append(commands, exec.Command("packer", "version"))
logrus.Println(p.Config.Actions)
// Add commands listed from Actions // Add commands listed from Actions
for _, action := range p.Config.Actions { for _, action := range p.Config.Actions {
switch action { switch action {

Loading…
Cancel
Save