Skip to content

Commit

Permalink
Skip packer init for non-HCL templates
Browse files Browse the repository at this point in the history
  • Loading branch information
bwhaley committed Aug 15, 2021
1 parent 10215ee commit 6e2135f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/packer/packer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"sync"
"time"
Expand Down Expand Up @@ -214,6 +215,12 @@ func packerInit(t testing.TestingT, options *Options) error {
return nil
}

extension := filepath.Ext(options.Template)
if extension != ".hcl" {
options.Logger.Logf(t, "Skipping 'packer init' because it is only supported for HCL2 templates")
return nil
}

cmd := shell.Command{
Command: "packer",
Args: []string{"init", options.Template},
Expand Down

0 comments on commit 6e2135f

Please sign in to comment.