From 8512ac0c8ac5a3400bb78fcdbf15a012da93c0c5 Mon Sep 17 00:00:00 2001 From: iwilltry42 Date: Tue, 14 May 2019 20:48:48 +0200 Subject: [PATCH] make server the default node for portmaps --- cli/port.go | 4 ++++ cli/util.go | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cli/port.go b/cli/port.go index 1273381d..544dc67f 100644 --- a/cli/port.go +++ b/cli/port.go @@ -39,6 +39,10 @@ func mapNodesToPortSpecs(specs []string, createdNodes []string) (map[string][]st for _, spec := range specs { nodes, portSpec := extractNodes(spec) + if len(nodes) == 0 { + nodes = append(nodes, defaultNodes) + } + for _, node := range nodes { // check if node-specifier is valid (either a role or a name) and append to list if matches nodeFound := false diff --git a/cli/util.go b/cli/util.go index 7a235e73..982be805 100644 --- a/cli/util.go +++ b/cli/util.go @@ -49,7 +49,10 @@ func CheckClusterName(name string) error { if len(name) > clusterNameMaxSize { return fmt.Errorf("[ERROR] Cluster name is too long (%d > %d)", len(name), clusterNameMaxSize) } - return fmt.Errorf("[ERROR] Invalid cluster name\n%+v", ValidateHostname(name)) + if err := ValidateHostname(name); err != nil { + return fmt.Errorf("[ERROR] Invalid cluster name\n%+v", ValidateHostname(name)) + } + return nil } // ValidateHostname ensures that a cluster name is also a valid host name according to RFC 1123.