Skip to content

Commit

Permalink
start off by printing list of instances
Browse files Browse the repository at this point in the history
  • Loading branch information
aidansteele committed Aug 24, 2017
1 parent 9b4fea6 commit 3d62f3a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions run.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func doit(sess *session.Session, targets []*ssm.Target, bucket, keyPrefix, comma
commandId := resp.Command.CommandId
printedInstanceIds := []string{}

printedInstanceList := false

for {
time.Sleep(time.Second * 3)
Expand All @@ -125,6 +126,15 @@ func doit(sess *session.Session, targets []*ssm.Target, bucket, keyPrefix, comma
log.Panicf(err.Error())
}

if !printedInstanceList {
instanceIds := []string{}
for _, invocation := range resp3.CommandInvocations {
instanceIds = append(instanceIds, *invocation.InstanceId)
}
color.Blue("Running command on instances: %+v\n", instanceIds)
printedInstanceList = true
}

for _, invocation := range resp3.CommandInvocations {
instanceId := *invocation.InstanceId
if stringInSlice(instanceId, printedInstanceIds) {
Expand Down

0 comments on commit 3d62f3a

Please sign in to comment.