internal/providercache: fix error message for protocol mismatch (#24818)

There was a bug in the installer trying to pass a nil error.
This commit is contained in:
Kristin Laemmert 2020-04-30 11:12:04 -04:00 committed by GitHub
parent 87bce5f9dd
commit ce03f1255f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -505,7 +505,7 @@ func (c *InitCommand) getProviders(earlyConfig *earlyconfig.Config, state *state
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Failed to install provider",
fmt.Sprintf("Error while installing %s v%s: %s.", provider.ForDisplay(), version, err),
fmt.Sprintf("Error while installing %s v%s: %s", provider.ForDisplay(), version, err),
))
},
FetchPackageSuccess: func(provider addrs.Provider, version getproviders.Version, localDir string, authResult *getproviders.PackageAuthenticationResult) {

View File

@ -343,7 +343,8 @@ NeedProvider:
protoErr = providerProtocolTooOld
}
errs[provider] = fmt.Errorf(protoErr, provider, version, tfversion.String(), closestAvailable.String(), closestAvailable.String(), getproviders.VersionConstraintsString(reqs[provider]))
err := fmt.Errorf(protoErr, provider, version, tfversion.String(), closestAvailable.String(), closestAvailable.String(), getproviders.VersionConstraintsString(reqs[provider]))
errs[provider] = err
if cb := evts.FetchPackageFailure; cb != nil {
cb(provider, version, err)
}