Repository: brooklyn-client
Updated Branches:
  refs/heads/master 18967dfcf -> cedb35079


Default login port to 80/443 if not supplied


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/925c8ca1
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/925c8ca1
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/925c8ca1

Branch: refs/heads/master
Commit: 925c8ca1921bb56fa7f236773727984fca1a264b
Parents: 18967df
Author: Geoff Macartney <[email protected]>
Authored: Thu Nov 9 22:15:01 2017 +0000
Committer: Geoff Macartney <[email protected]>
Committed: Thu Nov 9 22:19:43 2017 +0000

----------------------------------------------------------------------
 cli/net/net.go | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/925c8ca1/cli/net/net.go
----------------------------------------------------------------------
diff --git a/cli/net/net.go b/cli/net/net.go
index 3843673..447df99 100644
--- a/cli/net/net.go
+++ b/cli/net/net.go
@@ -34,6 +34,7 @@ import (
        "crypto/tls"
        "net"
        "time"
+       "strings"
 )
 
 type Network struct {
@@ -279,6 +280,15 @@ func VerifyLoginURL(network *Network) error {
        if url.Host == "" {
                return errors.New("Use login command to set Brooklyn URL with a 
valid host[:port]")
        }
+       if len(strings.Split(url.Host, ":")) < 2 {
+               if url.Scheme == "https" {
+                       url.Host += ":443"
+                       network.BrooklynUrl = url.String()
+               } else if url.Scheme == "http" {
+                       url.Host += ":80"
+                       network.BrooklynUrl = url.String()
+               }
+       }
        _, err = net.DialTimeout("tcp", url.Host, time.Duration(30) * 
time.Second)
        if err != nil {
                return errors.New("Could not connect to " + url.Host)

Reply via email to