From 5794008b6807270f96b5de70a73fb392e1519ff1 Mon Sep 17 00:00:00 2001 From: yupengzte Date: Thu, 27 Apr 2017 11:31:01 +0800 Subject: [PATCH] delete ineffectual assignment Signed-off-by: yupengzte --- cli/command/service/logs.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cli/command/service/logs.go b/cli/command/service/logs.go index 2440c1680e..32a3f3557a 100644 --- a/cli/command/service/logs.go +++ b/cli/command/service/logs.go @@ -93,6 +93,14 @@ func runLogs(dockerCli *command.DockerCli, opts *logsOptions) error { return err } 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 // TODO(dperny) hot fix until we get a nice details system squared away, // 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) 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 } + maxLength = getMaxLength(task.Slot) - responseBody, err = cli.TaskLogs(ctx, opts.target, options) } else { tty = service.Spec.TaskTemplate.ContainerSpec.TTY // TODO(dperny) hot fix until we get a nice details system squared away,