k8s: Change default cluster access method choice logic 97/96297/1
authorPawel Wieczorek <p.wieczorek2@samsung.com>
Thu, 26 Sep 2019 12:50:16 +0000 (14:50 +0200)
committerPawel Wieczorek <p.wieczorek2@samsung.com>
Thu, 26 Sep 2019 17:02:01 +0000 (19:02 +0200)
Previous way of choosing it led to impractical calls, e.g.

$ ./check -rke                   # (works fine)
$ ./check -ranchercli            # "Not supported."
$ ./check -ranchercli -rke=false # (works fine)

Disabling default cluster access method is no longer necessary.

Issue-ID: SECCOM-235
Change-Id: I2b4d5bff10c5470e567351abeac0431bed3b7938
Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
test/security/k8s/src/check/cmd/check/check.go

index 5a29fa9..80a17f0 100644 (file)
@@ -11,7 +11,7 @@ import (
 
 var (
        ranchercli = flag.Bool("ranchercli", false, "use rancher utility for accessing cluster nodes")
-       rke        = flag.Bool("rke", true, "use RKE cluster definition and ssh for accessing cluster nodes (default)")
+       rke        = flag.Bool("rke", false, "use RKE cluster definition and ssh for accessing cluster nodes (default)")
 )
 
 func main() {
@@ -20,6 +20,11 @@ func main() {
                log.Fatal("Not supported.")
        }
 
+       // Use default cluster access method if none was declared explicitly.
+       if !(*ranchercli || *rke) {
+               *rke = true
+       }
+
        var (
                k8sParams []string
                err       error