cmd/osbuild-service-maintenance: respect dry run
Respect dry run when terminating leftover SIs.
This commit is contained in:
parent
0ef0ae7c97
commit
c1b67440c4
1 changed files with 8 additions and 3 deletions
|
|
@ -91,9 +91,14 @@ func AWSCleanup(maxConcurrentRequests int, dryRun bool, accessKeyID, accessKey s
|
||||||
}
|
}
|
||||||
|
|
||||||
instanceIDs := filterReservations(reservations)
|
instanceIDs := filterReservations(reservations)
|
||||||
err = a.TerminateInstances(instanceIDs)
|
logrus.Infof("Cleaning up executor instances: %v", instanceIDs)
|
||||||
if err != nil {
|
if !dryRun {
|
||||||
return fmt.Errorf("Unable to terminate secure instances: %w", err)
|
err = a.TerminateInstances(instanceIDs)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Unable to terminate secure instances: %w", err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logrus.Info("Dry run, didn't actually terminate any instances")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue