From d597e93e70a11787deff7fd4a37837773c8fcc55 Mon Sep 17 00:00:00 2001 From: Wilken Rivera Date: Fri, 25 Sep 2020 12:12:31 -0400 Subject: [PATCH] improve error message --- command/init.go | 10 ---------- hcl2template/parser.go | 6 +++--- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/command/init.go b/command/init.go index 5519184b6..b71246c15 100644 --- a/command/init.go +++ b/command/init.go @@ -2,10 +2,7 @@ package command import ( "context" - "fmt" "os" - - "github.com/hashicorp/packer/version" ) // InitCommand initializes a Packer working directory. @@ -52,13 +49,6 @@ func (c *InitCommand) RunContext(ctx context.Context, cla *InitArgs) int { packerStarter, ret := c.GetConfig(&cla.MetaArgs) if ret != 0 { - fmt.Printf(`%s - -Packer initialized with no template! - -The directory has no Packer templates. You may begin working -with Packer immediately by creating a Packer template. -`, version.FormattedVersion()) return ret } diff --git a/hcl2template/parser.go b/hcl2template/parser.go index 776d6abec..49b441b50 100644 --- a/hcl2template/parser.go +++ b/hcl2template/parser.go @@ -71,9 +71,9 @@ func (p *Parser) Parse(filename string, varFiles []string, argVars map[string]st if len(hclFiles)+len(jsonFiles) == 0 { diags = append(diags, &hcl.Diagnostic{ Severity: hcl.DiagError, - Summary: "Could not find any config file in " + filename, - Detail: "A config file must be suffixed with `.pkr.hcl` or " + - "`.pkr.json`. A folder can be referenced.", + Summary: "No configuration files found in " + filename, + Detail: "A valid configuration file must be present. Configuration \n" + + "files must be suffixed with `.pkr.hcl` or `.pkr.json`.", }) } for _, filename := range hclFiles {