internal/awscloud: use AWS.TerminateInstancesEC2() from osbuild/images
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
74d2edb772
commit
e7d8431489
4 changed files with 2 additions and 18 deletions
|
|
@ -154,7 +154,7 @@ func terminateOrphanedSecureInstances(a *awscloud.AWS, dryRun bool) error {
|
|||
log.Printf("Cleaning up executor instances: %v", instanceIDs)
|
||||
if !dryRun {
|
||||
if len(instanceIDs) > 0 {
|
||||
err = a.TerminateInstances(instanceIDs)
|
||||
_, err = a.TerminateInstancesEC2(instanceIDs, 0)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to terminate secure instances: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ type EC2 interface {
|
|||
// Instances
|
||||
DescribeInstances(context.Context, *ec2.DescribeInstancesInput, ...func(*ec2.Options)) (*ec2.DescribeInstancesOutput, error)
|
||||
DescribeInstanceStatus(context.Context, *ec2.DescribeInstanceStatusInput, ...func(*ec2.Options)) (*ec2.DescribeInstanceStatusOutput, error)
|
||||
TerminateInstances(context.Context, *ec2.TerminateInstancesInput, ...func(*ec2.Options)) (*ec2.TerminateInstancesOutput, error)
|
||||
|
||||
// Fleets
|
||||
CreateFleet(context.Context, *ec2.CreateFleetInput, ...func(*ec2.Options)) (*ec2.CreateFleetOutput, error)
|
||||
|
|
|
|||
|
|
@ -110,16 +110,6 @@ func (a *AWS) DescribeInstancesByInstanceID(instanceID string) ([]ec2types.Reser
|
|||
return res.Reservations, nil
|
||||
}
|
||||
|
||||
func (a *AWS) TerminateInstances(instanceIDs []string) error {
|
||||
_, err := a.ec2.TerminateInstances(
|
||||
context.Background(),
|
||||
&ec2.TerminateInstancesInput{
|
||||
InstanceIds: instanceIDs,
|
||||
},
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *AWS) DescribeSecurityGroupsByPrefix(ctx context.Context, prefix string) ([]ec2types.SecurityGroup, error) {
|
||||
var securityGroups []ec2types.SecurityGroup
|
||||
|
||||
|
|
|
|||
|
|
@ -271,12 +271,7 @@ func (a *AWS) terminatePreviousSI(hostInstanceID string) (string, error) {
|
|||
}
|
||||
|
||||
instanceID := *descrInstancesOutput.Reservations[0].Instances[0].InstanceId
|
||||
_, err = a.ec2.TerminateInstances(
|
||||
context.Background(),
|
||||
&ec2.TerminateInstancesInput{
|
||||
InstanceIds: []string{instanceID},
|
||||
},
|
||||
)
|
||||
_, err = a.TerminateInstancesEC2([]string{instanceID}, 0)
|
||||
if err != nil {
|
||||
return instanceID, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue