Browse code

Merge pull request #21273 from jfrazelle/remove-dead-code

remove dead code

Alexander Morozov authored on 2016/03/18 01:16:02
Showing 9 changed files
... ...
@@ -287,22 +287,6 @@ func validateTag(rawRepo string) (string, error) {
287 287
 	return rawRepo, nil
288 288
 }
289 289
 
290
-// writeToFile copies from the given reader and writes it to a file with the
291
-// given filename.
292
-func writeToFile(r io.Reader, filename string) error {
293
-	file, err := os.OpenFile(filename, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, os.FileMode(0600))
294
-	if err != nil {
295
-		return fmt.Errorf("unable to create file: %v", err)
296
-	}
297
-	defer file.Close()
298
-
299
-	if _, err := io.Copy(file, r); err != nil {
300
-		return fmt.Errorf("unable to write file: %v", err)
301
-	}
302
-
303
-	return nil
304
-}
305
-
306 290
 var dockerfileFromLinePattern = regexp.MustCompile(`(?i)^[\s]*FROM[ \f\r\t\v]+(?P<image>[^ \f\r\t\v\n#]+)`)
307 291
 
308 292
 // resolvedTag records the repository, tag, and resolved digest reference
... ...
@@ -27,11 +27,6 @@ import (
27 27
 	"github.com/docker/go-connections/nat"
28 28
 )
29 29
 
30
-// dispatch with no layer / parsing. This is effectively not a command.
31
-func nullDispatch(b *Builder, args []string, attributes map[string]bool, original string) error {
32
-	return nil
33
-}
34
-
35 30
 // ENV foo bar
36 31
 //
37 32
 // Sets the environment variable foo to bar, also makes interpolation
... ...
@@ -14,7 +14,6 @@ import (
14 14
 var (
15 15
 	defaultPidFile = "/var/run/docker.pid"
16 16
 	defaultGraph   = "/var/lib/docker"
17
-	defaultExec    = "native"
18 17
 )
19 18
 
20 19
 // Config defines the configuration of a docker daemon.
... ...
@@ -9,7 +9,6 @@ import (
9 9
 var (
10 10
 	defaultPidFile = os.Getenv("programdata") + string(os.PathSeparator) + "docker.pid"
11 11
 	defaultGraph   = os.Getenv("programdata") + string(os.PathSeparator) + "docker"
12
-	defaultExec    = "windows"
13 12
 )
14 13
 
15 14
 // bridgeConfig stores all the bridge driver specific
... ...
@@ -38,8 +38,3 @@ func initializer() {
38 38
 
39 39
 	panic("unreachable")
40 40
 }
41
-
42
-func writeError(err error) {
43
-	fmt.Fprint(os.Stderr, err)
44
-	os.Exit(1)
45
-}
... ...
@@ -36,10 +36,6 @@ type layer struct {
36 36
 	Path string
37 37
 }
38 38
 
39
-type defConfig struct {
40
-	DefFile string
41
-}
42
-
43 39
 type portBinding struct {
44 40
 	Protocol     string
45 41
 	InternalPort int
... ...
@@ -3,7 +3,6 @@ package daemon
3 3
 import (
4 4
 	"os"
5 5
 	"runtime"
6
-	"strings"
7 6
 	"sync/atomic"
8 7
 	"time"
9 8
 
... ...
@@ -163,13 +162,3 @@ func (daemon *Daemon) showPluginsInfo() types.PluginsInfo {
163 163
 
164 164
 	return pluginsInfo
165 165
 }
166
-
167
-// The uppercase and the lowercase are available for the proxy settings.
168
-// See the Go specification for details on these variables. https://golang.org/pkg/net/http/
169
-func getProxyEnv(key string) string {
170
-	proxyValue := os.Getenv(strings.ToUpper(key))
171
-	if proxyValue == "" {
172
-		return os.Getenv(strings.ToLower(key))
173
-	}
174
-	return proxyValue
175
-}
... ...
@@ -24,12 +24,10 @@ type fluentd struct {
24 24
 }
25 25
 
26 26
 const (
27
-	name                             = "fluentd"
28
-	defaultHostName                  = "localhost"
29
-	defaultPort                      = 24224
30
-	defaultTagPrefix                 = "docker"
31
-	defaultIgnoreConnectErrorOnStart = false           // So that we do not break existing behaviour
32
-	defaultBufferLimit               = 1 * 1024 * 1024 // 1M buffer by default
27
+	name               = "fluentd"
28
+	defaultHostName    = "localhost"
29
+	defaultPort        = 24224
30
+	defaultBufferLimit = 1 * 1024 * 1024 // 1M buffer by default
33 31
 )
34 32
 
35 33
 func init() {
... ...
@@ -10,8 +10,6 @@ import (
10 10
 	"github.com/docker/docker/container"
11 11
 	"github.com/docker/docker/daemon/execdriver"
12 12
 	"github.com/docker/docker/volume"
13
-	volumedrivers "github.com/docker/docker/volume/drivers"
14
-	"github.com/docker/docker/volume/local"
15 13
 )
16 14
 
17 15
 // setupMounts iterates through each of the mount points for a container and
... ...
@@ -70,53 +68,6 @@ func sortMounts(m []execdriver.Mount) []execdriver.Mount {
70 70
 	return m
71 71
 }
72 72
 
73
-// migrateVolume links the contents of a volume created pre Docker 1.7
74
-// into the location expected by the local driver.
75
-// It creates a symlink from DOCKER_ROOT/vfs/dir/VOLUME_ID to DOCKER_ROOT/volumes/VOLUME_ID/_container_data.
76
-// It preserves the volume json configuration generated pre Docker 1.7 to be able to
77
-// downgrade from Docker 1.7 to Docker 1.6 without losing volume compatibility.
78
-func migrateVolume(id, vfs string) error {
79
-	l, err := volumedrivers.Lookup(volume.DefaultDriverName)
80
-	if err != nil {
81
-		return err
82
-	}
83
-
84
-	newDataPath := l.(*local.Root).DataPath(id)
85
-	fi, err := os.Stat(newDataPath)
86
-	if err != nil && !os.IsNotExist(err) {
87
-		return err
88
-	}
89
-
90
-	if fi != nil && fi.IsDir() {
91
-		return nil
92
-	}
93
-
94
-	return os.Symlink(vfs, newDataPath)
95
-}
96
-
97
-// validVolumeLayout checks whether the volume directory layout
98
-// is valid to work with Docker post 1.7 or not.
99
-func validVolumeLayout(files []os.FileInfo) bool {
100
-	if len(files) == 1 && files[0].Name() == local.VolumeDataPathName && files[0].IsDir() {
101
-		return true
102
-	}
103
-
104
-	if len(files) != 2 {
105
-		return false
106
-	}
107
-
108
-	for _, f := range files {
109
-		if f.Name() == "config.json" ||
110
-			(f.Name() == local.VolumeDataPathName && f.Mode()&os.ModeSymlink == os.ModeSymlink) {
111
-			// Old volume configuration, we ignore it
112
-			continue
113
-		}
114
-		return false
115
-	}
116
-
117
-	return true
118
-}
119
-
120 73
 // setBindModeIfNull is platform specific processing to ensure the
121 74
 // shared mode is set to 'z' if it is null. This is called in the case
122 75
 // of processing a named volume and not a typical bind.