File bsc#1114840-0001-Test-CTS-don-t-require-nodes-to-be-specified-if-only-1.1.patch of Package pacemaker.14737

From 4cce0b9c6e1ff8346deca109455bd1674853d9b1 Mon Sep 17 00:00:00 2001
From: Aleksei Burlakov <aleksei.burlakov@suse.com>
Date: Tue, 29 Jan 2019 12:04:11 +0100
Subject: [PATCH] Test: CTS: don't require nodes to be specified if only
 listing tests

This commit complements the 9c993a7cca76da81448263fdecd78aad2badd06f
but for 1.1 branch. Additionally to the original commit, it modifies
the CIB.py.
---
 cts/CIB.py         | 3 ++-
 cts/CTS.py         | 2 +-
 cts/environment.py | 9 ++++-----
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/cts/CIB.py b/cts/CIB.py
index c8f7ec05a..0f29f9688 100644
--- a/cts/CIB.py
+++ b/cts/CIB.py
@@ -467,7 +467,8 @@ class ConfigFactory:
         self.register("pacemaker12", CIB12, CM, self)
         self.register("pacemaker20", CIB20, CM, self)
 #        self.register("hae", HASI, CM, self)
-        self.target = self.CM.Env["nodes"][0]
+        if self.CM.Env["ListTests"] == 0:
+            self.target = self.CM.Env["nodes"][0]
         self.tmpfile = None
 
     def log(self, args):
diff --git a/cts/CTS.py b/cts/CTS.py
index 96ca1dd5e..9ee5e2ad3 100644
--- a/cts/CTS.py
+++ b/cts/CTS.py
@@ -121,7 +121,7 @@ class CtsLab:
 
     This class is derived from a UserDict because we hold many
     different parameters of different kinds, and this provides
-    provide a uniform and extensible interface useful for any kind of
+    a uniform and extensible interface useful for any kind of
     communication between the user/administrator/tester and CTS.
 
     At this point in time, it is the intent of this class to model static
diff --git a/cts/environment.py b/cts/environment.py
index 02b962ce6..46f6fb3b4 100644
--- a/cts/environment.py
+++ b/cts/environment.py
@@ -83,8 +83,9 @@ class Environment:
         self.target = "localhost"
 
         self.parse_args(args)
-        self.discover()
-        self.validate()
+        if self["ListTests"] == 0:
+            self.validate()
+            self.discover()
 
     def SeedRandom(self, seed=None):
         if not seed:
@@ -264,7 +265,7 @@ class Environment:
                               or self.service_is_enabled(self.target, "pacemaker")
 
     def detect_ip_offset(self):
-        # Try to determin an offset for IPaddr resources
+        # Try to determine an offset for IPaddr resources
         if self["CIBResource"] and not "IPBase" in self.data:
             network=self.rsh(self.target, "ip addr | grep inet | grep -v -e link -e inet6 -e '/32' -e ' lo' | awk '{print $2}'", stdout=1).strip()
             self["IPBase"] = self.rsh(self.target, "nmap -sn -n %s | grep 'scan report' | awk '{print $NF}' | sed 's:(::' | sed 's:)::' | sort -V | tail -n 1" % network, stdout=1).strip()
@@ -312,8 +313,6 @@ class Environment:
         self.detect_at_boot()
         self.detect_ip_offset()
 
-        self.validate()
-
     def parse_args(self, args):
         skipthis=None
 
-- 
2.16.4

openSUSE Build Service is sponsored by