mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-09 15:43:53 -06:00
d2e999ba1f
* remove unused code I've removed the provider-specific code under registry, and unused nil backend, and replaced a call to helper from backend/oss (the other callers of that func are provisioners scheduled to be deprecated). I also removed the Dockerfile, as our build process uses a different file. Finally I removed the examples directory, which had outdated examples and links. There are better, actively maintained examples available. * command: remove various unused bits * test wasn't running * backend: remove unused err
48 lines
1.3 KiB
Go
48 lines
1.3 KiB
Go
package registry
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/hashicorp/terraform-svchost/disco"
|
|
"github.com/hashicorp/terraform/registry/regsrc"
|
|
)
|
|
|
|
type errModuleNotFound struct {
|
|
addr *regsrc.Module
|
|
}
|
|
|
|
func (e *errModuleNotFound) Error() string {
|
|
return fmt.Sprintf("module %s not found", e.addr)
|
|
}
|
|
|
|
// IsModuleNotFound returns true only if the given error is a "module not found"
|
|
// error. This allows callers to recognize this particular error condition
|
|
// as distinct from operational errors such as poor network connectivity.
|
|
func IsModuleNotFound(err error) bool {
|
|
_, ok := err.(*errModuleNotFound)
|
|
return ok
|
|
}
|
|
|
|
// IsServiceNotProvided returns true only if the given error is a "service not provided"
|
|
// error. This allows callers to recognize this particular error condition
|
|
// as distinct from operational errors such as poor network connectivity.
|
|
func IsServiceNotProvided(err error) bool {
|
|
_, ok := err.(*disco.ErrServiceNotProvided)
|
|
return ok
|
|
}
|
|
|
|
// ServiceUnreachableError Registry service is unreachable
|
|
type ServiceUnreachableError struct {
|
|
err error
|
|
}
|
|
|
|
func (e *ServiceUnreachableError) Error() string {
|
|
return e.err.Error()
|
|
}
|
|
|
|
// IsServiceUnreachable returns true if the registry/discovery service was unreachable
|
|
func IsServiceUnreachable(err error) bool {
|
|
_, ok := err.(*ServiceUnreachableError)
|
|
return ok
|
|
}
|