Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions internal/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func (rc *ReportingCommand) Run() error {
channelTargetScriptOutputs := make(chan TargetScriptOutputs)
channelError := make(chan error)
for _, target := range myTargets {
go collectOnTarget(rc.Cmd, target, scriptsToRun, localTempDir, channelTargetScriptOutputs, channelError, multiSpinner.Status)
go collectOnTarget(rc.Cmd, rc.Duration, target, scriptsToRun, localTempDir, channelTargetScriptOutputs, channelError, multiSpinner.Status)
}
// wait for scripts to run on all targets
var allTargetScriptOutputs []TargetScriptOutputs
Expand Down Expand Up @@ -382,7 +382,7 @@ func DefaultInsightsFunc(allTableValues []report.TableValues, scriptOutputs map[
return insightsTableValues
}

func collectOnTarget(cmd *cobra.Command, myTarget target.Target, scriptsToRun []script.ScriptDefinition, localTempDir string, channelTargetScriptOutputs chan TargetScriptOutputs, channelError chan error, statusUpdate progress.MultiSpinnerUpdateFunc) {
func collectOnTarget(cmd *cobra.Command, duration int, myTarget target.Target, scriptsToRun []script.ScriptDefinition, localTempDir string, channelTargetScriptOutputs chan TargetScriptOutputs, channelError chan error, statusUpdate progress.MultiSpinnerUpdateFunc) {
// create a temporary directory on the target
var targetTempDir string
var err error
Expand All @@ -404,7 +404,11 @@ func collectOnTarget(cmd *cobra.Command, myTarget target.Target, scriptsToRun []
}()
}
// run the scripts on the target
_ = statusUpdate(myTarget.GetName(), "collecting data")
status := "collecting data"
if duration > 0 {
status = fmt.Sprintf("%s, duration=%ds", status, duration)
}
_ = statusUpdate(myTarget.GetName(), status)
scriptOutputs, err := script.RunScripts(myTarget, scriptsToRun, true, localTempDir)
if err != nil {
_ = statusUpdate(myTarget.GetName(), fmt.Sprintf("error collecting data: %v", err))
Expand Down