Skip to content

Commit

Permalink
Merge pull request #241 from openziti/capture-std-err
Browse files Browse the repository at this point in the history
Capture stderr as well as stdout to make debugging easier
  • Loading branch information
plorenz authored Nov 1, 2023
2 parents aff4d8c + c9b1f4f commit 4a395e9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/openziti/fablab
go 1.19

require (
github.com/aws/aws-sdk-go v1.46.7
github.com/aws/aws-sdk-go v1.47.0
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d
github.com/jedib0t/go-pretty/v6 v6.4.9
github.com/michaelquigley/figlet v0.0.0-20191015203154-054d06db54b4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/aws/aws-sdk-go v1.46.7 h1:IjvAWeiJZlbETOemOwvheN5L17CvKvKW0T1xOC6d3Sc=
github.com/aws/aws-sdk-go v1.46.7/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go v1.47.0 h1:/JUg9V1+xh+qBn8A6ec/l15ETPaMaBqxkjz+gg63dNk=
github.com/aws/aws-sdk-go v1.47.0/go.mod h1:DlEaEbWKZmsITVbqlSVvekPARM1HzeV9PMYg15ymSDA=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
Expand Down
2 changes: 1 addition & 1 deletion kernel/libssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func RemoteExecAllTo(sshConfig SshConfigFactory, out io.Writer, cmds ...string)
return err
}
session.Stdout = out

session.Stderr = out
if idx > 0 {
logrus.Infof("executing [%s]: '%s'", sshConfig.Address(), cmd)
}
Expand Down
20 changes: 15 additions & 5 deletions kernel/model/selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,24 @@ func (m *Model) ForEachHost(spec string, concurrency int, f func(host *Host) err

func (m *Model) ForEachComponent(spec string, concurrency int, f func(c *Component) error) error {
components := m.SelectComponents(spec)

var tasks []parallel.Task
for _, component := range components {
boundComponent := component
tasks = append(tasks, func() error {
return f(boundComponent)
})
if concurrency == 1 {
if err := f(component); err != nil {
return err
}
} else {
boundComponent := component
tasks = append(tasks, func() error {
return f(boundComponent)
})
}
}
return parallel.Execute(tasks, int64(concurrency))
if concurrency > 1 {
return parallel.Execute(tasks, int64(concurrency))
}
return nil
}

type EntityMatcher func(Entity) bool
Expand Down

0 comments on commit 4a395e9

Please sign in to comment.