better init wording

This commit is contained in:
Adrien Delorme 2021-03-16 13:36:42 +01:00
parent 172cec7223
commit 5497139f2a
1 changed files with 21 additions and 6 deletions

View File

@ -121,19 +121,34 @@ func (c *InitCommand) RunContext(buildCtx context.Context, cla *InitArgs) int {
Getters: getters,
})
if err != nil {
if pluginRequirement.Implicit {
msg := fmt.Sprintf(`
Warning, at least one component components used in your config file(s) has
moved out of Packer into the %[2]q plugin.
For that reason Packer implicitly required the installation of the latest
version of the %[1]s plugin. That process failed.
%s.
It could be because this plugin was not released publicly yet. Other Packer
command should just work.`,
pluginRequirement.Identifier.Type,
pluginRequirement.Identifier,
err)
c.Ui.Say(msg)
} else {
c.Ui.Error(err.Error())
ret = 1
}
}
if newInstall != nil {
if pluginRequirement.Implicit {
msg := fmt.Sprintf("Installed implicitly required plugin %s %s in %q", pluginRequirement.Identifier, newInstall.Version, newInstall.BinaryPath)
ui.Say(msg)
warn := fmt.Sprintf(`
Warning, some components used in your config file(s) have moved out of Packer
into the %[2]q plugin.
For that reason Packer will try to implicitly require the latest version of the
%[1]s plugin.
Warning, at least one component components used in your config file(s) has
moved out of Packer into the %[2]q plugin.
For that reason Packer implicitly required the installation of the latest
version of the %[1]s plugin.
Upon init Packer will always fetch the latest possible version of implicitly
required plugins and if a latest version is backward incompatible with your
config file or your version of Packer, a build will fail. To avoid this, lock