Browse code

Mount only host dir to copy files from

Cesar Wong authored on 2016/05/23 22:44:54
Showing 3 changed files
... ...
@@ -81,7 +81,7 @@ func catHostFile(hostFile string) string {
81 81
 func (h *HostHelper) CopyFromHost(sourceDir, destDir string) error {
82 82
 	container, err := h.runner().
83 83
 		Image(h.image).
84
-		Bind("/:/rootfs:ro").
84
+		Bind(fmt.Sprintf("%[1]s:%[1]s:ro", sourceDir)).
85 85
 		Create()
86 86
 	if err != nil {
87 87
 		return err
... ...
@@ -100,10 +100,9 @@ func (h *HostHelper) CopyFromHost(sourceDir, destDir string) error {
100 100
 		}
101 101
 		errors.LogError(os.Remove(localTarFile.Name()))
102 102
 	}()
103
-	hostPath := path.Join("/rootfs", sourceDir) + "/."
104
-	glog.V(4).Infof("Downloading from host path %s to local tar file: %s", hostPath, localTarFile.Name())
103
+	glog.V(4).Infof("Downloading from host path %s to local tar file: %s", sourceDir, localTarFile.Name())
105 104
 	err = h.client.DownloadFromContainer(container, docker.DownloadFromContainerOptions{
106
-		Path:         hostPath,
105
+		Path:         sourceDir,
107 106
 		OutputStream: localTarFile,
108 107
 	})
109 108
 	if err != nil {
... ...
@@ -340,7 +340,7 @@ func (h *Helper) copyConfig(hostDir string) (string, error) {
340 340
 		}
341 341
 		return "", err
342 342
 	}
343
-	return tempDir, nil
343
+	return filepath.Join(tempDir, filepath.Base(hostDir)), nil
344 344
 }
345 345
 
346 346
 func (h *Helper) updateConfig(configDir, hostDir, serverIP string) error {
... ...
@@ -436,7 +436,7 @@ func (c *ClientStartConfig) CheckAvailablePorts(out io.Writer) error {
436 436
 		err = c.OpenShiftHelper().TestPorts(openshift.PortsWithAlternateDNS)
437 437
 		if err == nil {
438 438
 			c.DNSPort = openshift.AlternateDNSPort
439
-			fmt.Fprintf(out, "WARNING: Binding DNS on port %d instead of 53, which may be not be resolvable from all clients.", openshift.AlternateDNSPort)
439
+			fmt.Fprintf(out, "WARNING: Binding DNS on port %d instead of 53, which may be not be resolvable from all clients.\n", openshift.AlternateDNSPort)
440 440
 			return nil
441 441
 		}
442 442
 	}