mirror of https://github.com/docker/docs.git
Merge pull request #7642 from LK4D4/style_fixes
Style fixes for daemon package
This commit is contained in:
commit
55f7dd8198
|
@ -127,7 +127,7 @@ func (daemon *Daemon) Attach(container *Container, stdin io.ReadCloser, stdinClo
|
||||||
)
|
)
|
||||||
|
|
||||||
if stdin != nil && container.Config.OpenStdin {
|
if stdin != nil && container.Config.OpenStdin {
|
||||||
nJobs += 1
|
nJobs++
|
||||||
if cStdin, err := container.StdinPipe(); err != nil {
|
if cStdin, err := container.StdinPipe(); err != nil {
|
||||||
errors <- err
|
errors <- err
|
||||||
} else {
|
} else {
|
||||||
|
@ -163,7 +163,7 @@ func (daemon *Daemon) Attach(container *Container, stdin io.ReadCloser, stdinClo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if stdout != nil {
|
if stdout != nil {
|
||||||
nJobs += 1
|
nJobs++
|
||||||
if p, err := container.StdoutPipe(); err != nil {
|
if p, err := container.StdoutPipe(); err != nil {
|
||||||
errors <- err
|
errors <- err
|
||||||
} else {
|
} else {
|
||||||
|
@ -201,7 +201,7 @@ func (daemon *Daemon) Attach(container *Container, stdin io.ReadCloser, stdinClo
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
if stderr != nil {
|
if stderr != nil {
|
||||||
nJobs += 1
|
nJobs++
|
||||||
if p, err := container.StderrPipe(); err != nil {
|
if p, err := container.StderrPipe(); err != nil {
|
||||||
errors <- err
|
errors <- err
|
||||||
} else {
|
} else {
|
||||||
|
@ -252,7 +252,7 @@ func (daemon *Daemon) Attach(container *Container, stdin io.ReadCloser, stdinClo
|
||||||
|
|
||||||
// FIXME: how to clean up the stdin goroutine without the unwanted side effect
|
// FIXME: how to clean up the stdin goroutine without the unwanted side effect
|
||||||
// of closing the passed stdin? Add an intermediary io.Pipe?
|
// of closing the passed stdin? Add an intermediary io.Pipe?
|
||||||
for i := 0; i < nJobs; i += 1 {
|
for i := 0; i < nJobs; i++ {
|
||||||
log.Debugf("attach: waiting for job %d/%d", i+1, nJobs)
|
log.Debugf("attach: waiting for job %d/%d", i+1, nJobs)
|
||||||
if err := <-errors; err != nil {
|
if err := <-errors; err != nil {
|
||||||
log.Errorf("attach: job %d returned error %s, aborting all jobs", i+1, err)
|
log.Errorf("attach: job %d returned error %s, aborting all jobs", i+1, err)
|
||||||
|
|
|
@ -476,19 +476,17 @@ func (b *buildFile) CmdVolume(args string) error {
|
||||||
|
|
||||||
func (b *buildFile) checkPathForAddition(orig string) error {
|
func (b *buildFile) checkPathForAddition(orig string) error {
|
||||||
origPath := path.Join(b.contextPath, orig)
|
origPath := path.Join(b.contextPath, orig)
|
||||||
if p, err := filepath.EvalSymlinks(origPath); err != nil {
|
origPath, err := filepath.EvalSymlinks(origPath)
|
||||||
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return fmt.Errorf("%s: no such file or directory", orig)
|
return fmt.Errorf("%s: no such file or directory", orig)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
} else {
|
|
||||||
origPath = p
|
|
||||||
}
|
}
|
||||||
if !strings.HasPrefix(origPath, b.contextPath) {
|
if !strings.HasPrefix(origPath, b.contextPath) {
|
||||||
return fmt.Errorf("Forbidden path outside the build context: %s (%s)", orig, origPath)
|
return fmt.Errorf("Forbidden path outside the build context: %s (%s)", orig, origPath)
|
||||||
}
|
}
|
||||||
_, err := os.Stat(origPath)
|
if _, err := os.Stat(origPath); err != nil {
|
||||||
if err != nil {
|
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return fmt.Errorf("%s: no such file or directory", orig)
|
return fmt.Errorf("%s: no such file or directory", orig)
|
||||||
}
|
}
|
||||||
|
@ -908,7 +906,7 @@ func (b *buildFile) Build(context io.Reader) (string, error) {
|
||||||
} else if b.rm {
|
} else if b.rm {
|
||||||
b.clearTmp(b.tmpContainers)
|
b.clearTmp(b.tmpContainers)
|
||||||
}
|
}
|
||||||
stepN += 1
|
stepN++
|
||||||
}
|
}
|
||||||
if b.image != "" {
|
if b.image != "" {
|
||||||
fmt.Fprintf(b.outStream, "Successfully built %s\n", utils.TruncateID(b.image))
|
fmt.Fprintf(b.outStream, "Successfully built %s\n", utils.TruncateID(b.image))
|
||||||
|
|
|
@ -910,7 +910,8 @@ func (container *Container) initializeNetworking() error {
|
||||||
container.HostsPath = hostsPath
|
container.HostsPath = hostsPath
|
||||||
|
|
||||||
return ioutil.WriteFile(container.HostsPath, content, 0644)
|
return ioutil.WriteFile(container.HostsPath, content, 0644)
|
||||||
} else if container.hostConfig.NetworkMode.IsContainer() {
|
}
|
||||||
|
if container.hostConfig.NetworkMode.IsContainer() {
|
||||||
// we need to get the hosts files from the container to join
|
// we need to get the hosts files from the container to join
|
||||||
nc, err := container.getNetworkedContainer()
|
nc, err := container.getNetworkedContainer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -920,16 +921,16 @@ func (container *Container) initializeNetworking() error {
|
||||||
container.ResolvConfPath = nc.ResolvConfPath
|
container.ResolvConfPath = nc.ResolvConfPath
|
||||||
container.Config.Hostname = nc.Config.Hostname
|
container.Config.Hostname = nc.Config.Hostname
|
||||||
container.Config.Domainname = nc.Config.Domainname
|
container.Config.Domainname = nc.Config.Domainname
|
||||||
} else if container.daemon.config.DisableNetwork {
|
return nil
|
||||||
|
}
|
||||||
|
if container.daemon.config.DisableNetwork {
|
||||||
container.Config.NetworkDisabled = true
|
container.Config.NetworkDisabled = true
|
||||||
return container.buildHostnameAndHostsFiles("127.0.1.1")
|
return container.buildHostnameAndHostsFiles("127.0.1.1")
|
||||||
} else {
|
|
||||||
if err := container.allocateNetwork(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return container.buildHostnameAndHostsFiles(container.NetworkSettings.IPAddress)
|
|
||||||
}
|
}
|
||||||
return nil
|
if err := container.allocateNetwork(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return container.buildHostnameAndHostsFiles(container.NetworkSettings.IPAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the config is compatible with the current kernel
|
// Make sure the config is compatible with the current kernel
|
||||||
|
|
Loading…
Reference in New Issue