mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-24 16:10:46 -06:00
Improve unclear provider resolver error messages (#1003)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
This commit is contained in:
parent
25a6f51732
commit
f1a57344bd
@ -91,7 +91,7 @@ func TestProviderDevOverrides(t *testing.T) {
|
||||
if got, want := stdout, `Provider development overrides are in effect`; !strings.Contains(got, want) {
|
||||
t.Errorf("stdout doesn't include the warning about development overrides\nwant: %s\n%s", want, got)
|
||||
}
|
||||
if got, want := stderr, `Failed to query available provider packages`; !strings.Contains(got, want) {
|
||||
if got, want := stderr, `Failed to resolve provider packages`; !strings.Contains(got, want) {
|
||||
t.Errorf("stderr doesn't include the error about listing unavailable development provider\nwant: %s\n%s", want, got)
|
||||
}
|
||||
}
|
||||
|
@ -715,8 +715,8 @@ func (c *InitCommand) getProviders(ctx context.Context, config *configs.Config,
|
||||
default:
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
"Failed to query available provider packages",
|
||||
fmt.Sprintf("Could not retrieve the list of available versions for provider %s: %s",
|
||||
"Failed to resolve provider packages",
|
||||
fmt.Sprintf("Could not resolve provider %s: %s",
|
||||
provider.ForDisplay(), err,
|
||||
),
|
||||
))
|
||||
|
@ -2803,11 +2803,10 @@ func TestInit_testsWithProvider(t *testing.T) {
|
||||
|
||||
got := ui.ErrorWriter.String()
|
||||
want := `
|
||||
Error: Failed to query available provider packages
|
||||
Error: Failed to resolve provider packages
|
||||
|
||||
Could not retrieve the list of available versions for provider
|
||||
hashicorp/test: no available releases match the given constraints 1.0.1,
|
||||
1.0.2
|
||||
Could not resolve provider hashicorp/test: no available releases match the
|
||||
given constraints 1.0.1, 1.0.2
|
||||
|
||||
`
|
||||
if diff := cmp.Diff(got, want); len(diff) > 0 {
|
||||
|
@ -329,6 +329,8 @@ NeedProvider:
|
||||
err = fmt.Errorf("the previously-selected version %s is no longer available", lock.Version())
|
||||
} else {
|
||||
err = fmt.Errorf("no available releases match the given constraints %s", getproviders.VersionConstraintsString(reqs[provider]))
|
||||
log.Printf("[DEBUG] %s", err.Error())
|
||||
log.Printf("[DEBUG] Available releases: %s", available)
|
||||
}
|
||||
errs[provider] = err
|
||||
if cb := evts.QueryPackagesFailure; cb != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user