Skip to content

Commit

Permalink
aws: minor refactoring
Browse files Browse the repository at this point in the history
Simplify/refactor error checking.

Signed-off-by: Mike Frisch <mikef17@gmail.com>
  • Loading branch information
EmmEff committed Feb 10, 2025
1 parent 222e3cf commit c04ee8f
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/cloud-providers/aws/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,9 @@ func (p *awsProvider) getPublicIP(ctx context.Context, instanceID string) (netip
}

// Wait for instance to be ready before getting the public IP address
err := p.waiter.Wait(ctx, describeInstanceInput, maxWaitTime)
if err != nil {
if err := p.waiter.Wait(ctx, describeInstanceInput, maxWaitTime); err != nil {
logger.Printf("failed to wait for instance %s to be ready: %v", instanceID, err)
return netip.Addr{}, err

}

// Add describe instance output
Expand All @@ -454,12 +452,7 @@ func (p *awsProvider) getPublicIP(ctx context.Context, instanceID string) (netip
logger.Printf("public IP address instance %s: %s", instanceID, *publicIP)

// Parse the public IP address
publicIPAddr, err := netip.ParseAddr(*publicIP)
if err != nil {
return netip.Addr{}, err
}

return publicIPAddr, nil
return netip.ParseAddr(*publicIP)
}

func (p *awsProvider) getDeviceNameAndSize(imageID string) (string, int32, error) {
Expand Down

0 comments on commit c04ee8f

Please sign in to comment.