Skip to content

Commit

Permalink
Merge pull request #238 from padilo/ssh-fallback-priv
Browse files Browse the repository at this point in the history
Fallback to private ip if instance doesn't have public
  • Loading branch information
hbi-wallix authored Dec 10, 2018
2 parents 8c1a034 + 565675c commit 7d279d1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions commands/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ var sshCmd = &cobra.Command{
} else {
if pub := connectionCtx.ip; pub != "" {
firsHopClient.IP = connectionCtx.ip
} else if priv := connectionCtx.privip; priv != "" {
firsHopClient.IP = connectionCtx.privip
} else {
logger.Infof("`--private` flag can be used to connect through instance's private IP '%s'", connectionCtx.privip)
exitOn(fmt.Errorf("no public IP resolved for instance %s (state '%s')", connectionCtx.instance.Id(), connectionCtx.state))
exitOn(fmt.Errorf("no public/private IP resolved for instance %s (state '%s')", connectionCtx.instance.Id(), connectionCtx.state))
}
}

Expand Down

0 comments on commit 7d279d1

Please sign in to comment.