Skip to content

Instantly share code, notes, and snippets.

@cgwalters
Last active March 11, 2020 19:36
Show Gist options
  • Save cgwalters/6ae78295f94d872a2975b72105aedd95 to your computer and use it in GitHub Desktop.
Save cgwalters/6ae78295f94d872a2975b72105aedd95 to your computer and use it in GitHub Desktop.
From f5771ce23b71492167ce7ce592a369f1a1a5d0c9 Mon Sep 17 00:00:00 2001
From: Colin Walters <[email protected]>
Date: Wed, 11 Mar 2020 19:20:51 +0000
Subject: [PATCH] mantle: Really avoid crashing if no port is set for SSH
Actually tested this time.
---
mantle/platform/cluster.go | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mantle/platform/cluster.go b/mantle/platform/cluster.go
index d2ed42f7..db040c93 100644
--- a/mantle/platform/cluster.go
+++ b/mantle/platform/cluster.go
@@ -131,7 +131,9 @@ func (bc *BaseCluster) appendSSH(m Machine) error {
}
host, port, err := net.SplitHostPort(m.IP())
if err != nil {
- return errors.Wrapf(err, "parsing machine IP")
+ // Yeah this is hacky, surprising there's not a stdlib API for this
+ host = m.IP()
+ port = ""
}
if port != "" {
if _, err := fmt.Fprintf(sshBuf, " Port %s\n", port); err != nil {
--
2.24.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment