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:
parent
a49e7d7f18
commit
4ae4474734
@ -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{
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ type Plugin struct {
|
||||
type Settings struct {
|
||||
Action cli.StringSlice
|
||||
|
||||
Version string
|
||||
TofuVersion string
|
||||
InitOptions InitOptions
|
||||
FmtOptions FmtOptions
|
||||
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user