0
0
mirror of https://github.com/thegeeklab/wp-opentofu.git synced 2024-11-23 07:00:40 +00:00

fix duplicate flag name

This commit is contained in:
Robert Kaussow 2024-02-05 21:50:41 +01:00
parent a49e7d7f18
commit 4ae4474734
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
4 changed files with 11 additions and 11 deletions

View File

@ -58,10 +58,10 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
Category: category,
},
&cli.StringFlag{
Name: "version",
Name: "tofu-version",
Usage: "tofu version to use",
EnvVars: []string{"PLUGIN_VERSION"},
Destination: &settings.Version,
EnvVars: []string{"PLUGIN_TOFU_VERSION"},
Destination: &settings.TofuVersion,
Category: category,
},
&cli.BoolFlag{

View File

@ -14,7 +14,7 @@ var (
ErrTaintedPath = errors.New("filepath is tainted")
ErrMaxSizeSizeLimit = errors.New("max size limit of decoded data exceeded")
ErrActionUnknown = errors.New("action not found")
ErrInvalidVersion = errors.New("invalid version string")
ErrInvalidTofuVersion = errors.New("invalid version string")
)
const (
@ -47,8 +47,8 @@ func (p *Plugin) Validate() error {
p.Settings.OutFile = fmt.Sprintf("%s.plan.tfout", p.Settings.DataDir)
}
if p.Settings.Version != "" {
err := installPackage(p.Plugin.Network.Context, p.Plugin.Network.Client, p.Settings.Version, maxDecompressionSize)
if p.Settings.TofuVersion != "" {
err := installPackage(p.Plugin.Network.Context, p.Plugin.Network.Client, p.Settings.TofuVersion, maxDecompressionSize)
if err != nil {
return err
}

View File

@ -15,7 +15,7 @@ type Plugin struct {
type Settings struct {
Action cli.StringSlice
Version string
TofuVersion string
InitOptions InitOptions
FmtOptions FmtOptions

View File

@ -16,7 +16,7 @@ import (
func installPackage(ctx context.Context, client *http.Client, version string, maxSize int64) error {
// Sanitize user input
if _, err := semver.NewVersion(version); err != nil {
return fmt.Errorf("%w: %v", ErrInvalidVersion, version)
return fmt.Errorf("%w: %v", ErrInvalidTofuVersion, version)
}
err := downloadPackage(