Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D63E0200D3B for ; Fri, 10 Nov 2017 10:29:50 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id D4E06160C03; Fri, 10 Nov 2017 09:29:50 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 27AEC160BEE for ; Fri, 10 Nov 2017 10:29:50 +0100 (CET) Received: (qmail 33912 invoked by uid 500); 10 Nov 2017 09:29:49 -0000 Mailing-List: contact commits-help@brooklyn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.apache.org Delivered-To: mailing list commits@brooklyn.apache.org Received: (qmail 33903 invoked by uid 99); 10 Nov 2017 09:29:49 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Nov 2017 09:29:49 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 75835DFCFC; Fri, 10 Nov 2017 09:29:48 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tbouron@apache.org To: commits@brooklyn.apache.org Date: Fri, 10 Nov 2017 09:29:48 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/2] brooklyn-client git commit: Default login port to 80/443 if not supplied archived-at: Fri, 10 Nov 2017 09:29:51 -0000 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 Authored: Thu Nov 9 22:15:01 2017 +0000 Committer: Geoff Macartney 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)