From 5ee75e2fa5875af79830c04a87443a28b1c448df Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Tue, 23 Feb 2016 10:33:58 -0800 Subject: [PATCH] Limit the set of downloaders --- client/getter/getter.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/client/getter/getter.go b/client/getter/getter.go index 91fe4fed5da..7dc1b7bd52a 100644 --- a/client/getter/getter.go +++ b/client/getter/getter.go @@ -19,6 +19,9 @@ var ( // and the lock is used to guard access to it. getters map[string]gg.Getter lock sync.Mutex + + // supported is the set of download schemes supported by Nomad + supported = []string{"http", "https", "s3"} ) // getClient returns a client that is suitable for Nomad. @@ -28,12 +31,12 @@ func getClient(src, dst string) *gg.Client { // Return the pre-initialized client if getters == nil { - getters = make(map[string]gg.Getter, len(gg.Getters)) - for k, v := range gg.Getters { - getters[k] = v + getters = make(map[string]gg.Getter, len(supported)) + for _, getter := range supported { + if impl, ok := gg.Getters[getter]; ok { + getters[getter] = impl + } } - - getters["file"] = &gg.FileGetter{Copy: true} } return &gg.Client{