Skip to content

Commit

Permalink
don't show remote target in main log if no remote commands in
Browse files Browse the repository at this point in the history
  • Loading branch information
umputun committed May 14, 2023
1 parent 9c8ae2f commit 58c9196
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ func (p *Process) runTaskOnHost(ctx context.Context, tsk *config.Task, hostAddr,
}
defer remote.Close()
remote.SetSecrets(p.secrets)
report(hostAddr, hostName, "run task %q, commands: %d\n", tsk.Name, len(tsk.Commands))
} else {
report("localhost", "", "run task %q, commands: %d (local)\n", tsk.Name, len(tsk.Commands))
}

report(hostAddr, hostName, "run task %q, commands: %d\n", tsk.Name, len(tsk.Commands))
count := 0
tskVars := vars{}
for _, cmd := range tsk.Commands {
Expand Down Expand Up @@ -159,7 +161,11 @@ func (p *Process) runTaskOnHost(ctx context.Context, tsk *config.Task, hostAddr,
}
}

report(hostAddr, hostName, "completed task %q, commands: %d (%v)\n", tsk.Name, count, since(stTask))
if p.anyRemoteCommand(tsk) {
report(hostAddr, hostName, "completed task %q, commands: %d (%v)\n", tsk.Name, count, since(stTask))
} else {
report("localhost", "", "completed task %q, commands: %d (%v)\n", tsk.Name, count, since(stTask))
}
return count, tskVars, nil
}

Expand Down

0 comments on commit 58c9196

Please sign in to comment.