diff --git a/packer/plugin-getter/github/getter.go b/packer/plugin-getter/github/getter.go index c34e092a8..c33c55d77 100644 --- a/packer/plugin-getter/github/getter.go +++ b/packer/plugin-getter/github/getter.go @@ -23,6 +23,7 @@ import ( const ( ghTokenAccessor = "PACKER_GITHUB_API_TOKEN" defaultUserAgent = "packer-plugin-getter" + defaultHostname = "github.com" ) type Getter struct { @@ -154,6 +155,11 @@ func (t *HostSpecificTokenAuthTransport) base() http.RoundTripper { } func (g *Getter) Get(what string, opts plugingetter.GetOptions) (io.ReadCloser, error) { + if opts.PluginRequirement.Identifier.Hostname != defaultHostname { + s := opts.PluginRequirement.Identifier.String() + " doesn't appear to be a valid " + defaultHostname + " source address; check source and try again." + return nil, errors.New(s) + } + ctx := context.TODO() if g.Client == nil { var tc *http.Client diff --git a/packer/plugin-getter/plugins.go b/packer/plugin-getter/plugins.go index 9dd670741..9595b67a0 100644 --- a/packer/plugin-getter/plugins.go +++ b/packer/plugin-getter/plugins.go @@ -345,7 +345,7 @@ func (pr *Requirement) InstallLatest(opts InstallOptions) (*Installation, error) getters := opts.Getters fail := fmt.Errorf("could not find a local nor a remote checksum for plugin %q %q", pr.Identifier, pr.VersionConstraints) - log.Printf("[TRACE] getting available versions for the the %s plugin", pr.Identifier) + log.Printf("[TRACE] getting available versions for the %s plugin", pr.Identifier) versions := version.Collection{} for _, getter := range getters {