You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2018/12/07 16:32:09 UTC

[GitHub] rawlinp closed pull request #3083: grovetccfg: use kernel host name if -host argument is not used on the command line.

rawlinp closed pull request #3083: grovetccfg: use kernel host name if -host argument is not used on the command line.
URL: https://github.com/apache/trafficcontrol/pull/3083
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/grove/grovetccfg/grovetccfg.go b/grove/grovetccfg/grovetccfg.go
index 20867eed9..60250ea68 100644
--- a/grove/grovetccfg/grovetccfg.go
+++ b/grove/grovetccfg/grovetccfg.go
@@ -188,8 +188,14 @@ func main() {
 	flag.Parse()
 
 	if host == nil || *host == "" {
-		fmt.Println(time.Now().Format(time.RFC3339Nano) + " Error, a 'host' is required, use '-host'")
-		os.Exit(1)
+		// if the host was not specified on the command line, get it from the kernel
+		h, err := os.Hostname()
+		if err != nil {
+			fmt.Println(time.Now().Format(time.RFC3339Nano) + err.Error() + " and 'host' is required, use '-host'")
+			os.Exit(1)
+		}
+		sl := strings.Split(h, ".")
+		*host = sl[0]
 	}
 
 	useCache := false


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services