mirror of https://github.com/docker/cli.git
delete ineffectual assignment
Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
This commit is contained in:
parent
169160ba63
commit
9ca78094b5
|
@ -92,7 +92,15 @@ func runLogs(dockerCli *command.DockerCli, opts *logsOptions) error {
|
||||||
if !client.IsErrServiceNotFound(err) {
|
if !client.IsErrServiceNotFound(err) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
task, _, _ := cli.TaskInspectWithRaw(ctx, opts.target)
|
task, _, err := cli.TaskInspectWithRaw(ctx, opts.target)
|
||||||
|
if err != nil {
|
||||||
|
if client.IsErrTaskNotFound(err) {
|
||||||
|
// if the task isn't found, rewrite the error to be clear
|
||||||
|
// that we looked for services AND tasks and found none
|
||||||
|
err = fmt.Errorf("no such task or service")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
tty = task.Spec.ContainerSpec.TTY
|
tty = task.Spec.ContainerSpec.TTY
|
||||||
// TODO(dperny) hot fix until we get a nice details system squared away,
|
// TODO(dperny) hot fix until we get a nice details system squared away,
|
||||||
// ignores details (including task context) if we have a TTY log
|
// ignores details (including task context) if we have a TTY log
|
||||||
|
@ -104,15 +112,10 @@ func runLogs(dockerCli *command.DockerCli, opts *logsOptions) error {
|
||||||
|
|
||||||
responseBody, err = cli.TaskLogs(ctx, opts.target, options)
|
responseBody, err = cli.TaskLogs(ctx, opts.target, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if client.IsErrTaskNotFound(err) {
|
|
||||||
// if the task ALSO isn't found, rewrite the error to be clear
|
|
||||||
// that we looked for services AND tasks
|
|
||||||
err = fmt.Errorf("No such task or service")
|
|
||||||
}
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
maxLength = getMaxLength(task.Slot)
|
maxLength = getMaxLength(task.Slot)
|
||||||
responseBody, _ = cli.TaskLogs(ctx, opts.target, options)
|
|
||||||
} else {
|
} else {
|
||||||
tty = service.Spec.TaskTemplate.ContainerSpec.TTY
|
tty = service.Spec.TaskTemplate.ContainerSpec.TTY
|
||||||
// TODO(dperny) hot fix until we get a nice details system squared away,
|
// TODO(dperny) hot fix until we get a nice details system squared away,
|
||||||
|
|
Loading…
Reference in New Issue