mirror of
https://github.com/hashicorp/packer.git
synced 2026-10-14 02:02:02 -04:00
improve error message
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user