Skip to content

Commit

Permalink
Merge pull request #42 from ocampeau/master
Browse files Browse the repository at this point in the history
Fix bug where instance only has either public or private ip.
  • Loading branch information
gjbae1212 authored Aug 29, 2021
2 parents e65a494 + 2f18966 commit 9cadf4f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,10 +501,10 @@ func findInstanceIdByIp(sess *session.Session, region, ip string) (string, error
}
for _, rv := range output.Reservations {
for _, inst := range rv.Instances {
if inst.PublicIpAddress == nil || inst.PrivateIpAddress == nil {
continue
if inst.PublicIpAddress != nil && ip == *inst.PublicIpAddress{
return *inst.InstanceId, nil
}
if ip == *inst.PublicIpAddress || ip == *inst.PrivateIpAddress {
if inst.PrivateIpAddress != nil && ip == *inst.PrivateIpAddress {
return *inst.InstanceId, nil
}
}
Expand Down

0 comments on commit 9cadf4f

Please sign in to comment.