You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by de...@apache.org on 2018/07/23 19:44:32 UTC

[trafficcontrol] branch master updated (fe38436 -> d58d66e)

This is an automated email from the ASF dual-hosted git repository.

dewrich pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git.


    from fe38436  protect against nil
     new 03b953d  properly handle missing listen field in cdn.conf
     new d58d66e  add quotes around listen field name in error message

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 traffic_ops/traffic_ops_golang/config/config.go | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)


[trafficcontrol] 02/02: add quotes around listen field name in error message

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dewrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit d58d66ee79e6bf2608196c956adf3361de4fd506
Author: Dylan Volz <Dy...@comcast.com>
AuthorDate: Mon Jul 23 13:42:36 2018 -0600

    add quotes around listen field name in error message
---
 traffic_ops/traffic_ops_golang/config/config.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/traffic_ops/traffic_ops_golang/config/config.go b/traffic_ops/traffic_ops_golang/config/config.go
index 8257981..afbfa19 100644
--- a/traffic_ops/traffic_ops_golang/config/config.go
+++ b/traffic_ops/traffic_ops_golang/config/config.go
@@ -257,7 +257,7 @@ func ParseConfig(cfg Config) (Config, error) {
 	invalidTOURLStr := ""
 	var err error
 	if len(cfg.Listen) < 1 {
-		missings += "listen, "
+		missings += `"listen", `
 	} else {
 		listen := cfg.Listen[0]
 		if cfg.URL, err = url.Parse(listen); err != nil {


[trafficcontrol] 01/02: properly handle missing listen field in cdn.conf

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dewrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit 03b953d1f20999fec79715190c9c0f119a958c29
Author: Dylan Volz <Dy...@comcast.com>
AuthorDate: Thu Jul 12 12:39:31 2018 -0600

    properly handle missing listen field in cdn.conf
---
 traffic_ops/traffic_ops_golang/config/config.go | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/traffic_ops/traffic_ops_golang/config/config.go b/traffic_ops/traffic_ops_golang/config/config.go
index 8b2152d..8257981 100644
--- a/traffic_ops/traffic_ops_golang/config/config.go
+++ b/traffic_ops/traffic_ops_golang/config/config.go
@@ -166,7 +166,7 @@ func LoadConfig(cdnConfPath string, dbConfPath string, riakConfPath string, appV
 	}
 	cfg, err = ParseConfig(cfg)
 	if err != nil {
-		return Config{}, []error{fmt.Errorf("parsing config '%s': %v", dbConfPath, err)}, BlockStartup
+		return Config{}, []error{fmt.Errorf("parsing config '%s': %v", cdnConfPath, err)}, BlockStartup
 	}
 
 	if riakConfPath != "" {
@@ -256,15 +256,19 @@ func ParseConfig(cfg Config) (Config, error) {
 
 	invalidTOURLStr := ""
 	var err error
-	listen := cfg.Listen[0]
-	if cfg.URL, err = url.Parse(listen); err != nil {
-		invalidTOURLStr = fmt.Sprintf("invalid Traffic Ops URL '%s': %v", listen, err)
-	}
-	cfg.KeyPath = cfg.GetKeyPath()
-	cfg.CertPath = cfg.GetCertPath()
+	if len(cfg.Listen) < 1 {
+		missings += "listen, "
+	} else {
+		listen := cfg.Listen[0]
+		if cfg.URL, err = url.Parse(listen); err != nil {
+			invalidTOURLStr = fmt.Sprintf("invalid Traffic Ops URL '%s': %v", listen, err)
+		}
+		cfg.KeyPath = cfg.GetKeyPath()
+		cfg.CertPath = cfg.GetCertPath()
 
-	newURL := url.URL{Scheme: cfg.URL.Scheme, Host: cfg.URL.Host, Path: cfg.URL.Path}
-	cfg.URL = &newURL
+		newURL := url.URL{Scheme: cfg.URL.Scheme, Host: cfg.URL.Host, Path: cfg.URL.Path}
+		cfg.URL = &newURL
+	}
 
 	if len(missings) > 0 {
 		missings = "missing fields: " + missings[:len(missings)-2] // strip final `, `