remove "~> 0.0" constraint suggestions
Don't suggest constraints when the available plugin isn't versioned. Add zero version const for comparisons.
This commit is contained in:
parent
14a2c04ddf
commit
ec99b6910b
|
@ -303,7 +303,7 @@ func (c *InitCommand) getProviders(path string, state *terraform.State, upgrade
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.Versions.Unconstrained() {
|
if req.Versions.Unconstrained() && meta.Version != discovery.VersionZero {
|
||||||
// meta.Version.MustParse is safe here because our "chosen" metas
|
// meta.Version.MustParse is safe here because our "chosen" metas
|
||||||
// were already filtered for validity of versions.
|
// were already filtered for validity of versions.
|
||||||
constraintSuggestions[name] = meta.Version.MustParse().MinorUpgradeConstraintStr()
|
constraintSuggestions[name] = meta.Version.MustParse().MinorUpgradeConstraintStr()
|
||||||
|
|
|
@ -153,7 +153,7 @@ func ResolvePluginPaths(paths []string) PluginMetaSet {
|
||||||
|
|
||||||
parts := strings.SplitN(baseName, "_v", 2)
|
parts := strings.SplitN(baseName, "_v", 2)
|
||||||
name := parts[0]
|
name := parts[0]
|
||||||
version := "0.0.0"
|
version := VersionZero
|
||||||
if len(parts) == 2 {
|
if len(parts) == 2 {
|
||||||
version = parts[1]
|
version = parts[1]
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ func (s PluginMetaSet) OverridePaths(paths map[string]string) PluginMetaSet {
|
||||||
for name, path := range paths {
|
for name, path := range paths {
|
||||||
ret.Add(PluginMeta{
|
ret.Add(PluginMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
Version: "0.0.0",
|
Version: VersionZero,
|
||||||
Path: path,
|
Path: path,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -402,14 +402,14 @@ func TestPluginMetaSetOverridePaths(t *testing.T) {
|
||||||
}
|
}
|
||||||
if !ns.Has(PluginMeta{
|
if !ns.Has(PluginMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Version: "0.0.0",
|
Version: VersionZero,
|
||||||
Path: "override-foo",
|
Path: "override-foo",
|
||||||
}) {
|
}) {
|
||||||
t.Errorf("new set is missing 'foo' override")
|
t.Errorf("new set is missing 'foo' override")
|
||||||
}
|
}
|
||||||
if !ns.Has(PluginMeta{
|
if !ns.Has(PluginMeta{
|
||||||
Name: "fun",
|
Name: "fun",
|
||||||
Version: "0.0.0",
|
Version: VersionZero,
|
||||||
Path: "override-fun",
|
Path: "override-fun",
|
||||||
}) {
|
}) {
|
||||||
t.Errorf("new set is missing 'fun' override")
|
t.Errorf("new set is missing 'fun' override")
|
||||||
|
|
|
@ -7,6 +7,8 @@ import (
|
||||||
version "github.com/hashicorp/go-version"
|
version "github.com/hashicorp/go-version"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const VersionZero = "0.0.0"
|
||||||
|
|
||||||
// A VersionStr is a string containing a possibly-invalid representation
|
// A VersionStr is a string containing a possibly-invalid representation
|
||||||
// of a semver version number. Call Parse on it to obtain a real Version
|
// of a semver version number. Call Parse on it to obtain a real Version
|
||||||
// object, or discover that it is invalid.
|
// object, or discover that it is invalid.
|
||||||
|
|
Loading…
Reference in New Issue