diff --git a/crmsh/cibverify.py b/crmsh/cibverify.py index 0a3c18fdd..2a91f9c1c 100644 --- a/crmsh/cibverify.py +++ b/crmsh/cibverify.py @@ -10,6 +10,7 @@ cib_verify = "crm_verify -VV -p" VALIDATE_RE = re.compile(r"^Entity: line (\d)+: element (\w+): " + r"Relax-NG validity error : (.+)$") +RC_MISCONFIGURATION = 78 # from pacemaker include/crm/common/results.h def _prettify(line, indent=0): @@ -20,8 +21,13 @@ def _prettify(line, indent=0): def verify(cib): + found_error = False rc, _, stderr = ShellUtils().get_stdout_stderr(cib_verify, cib.encode('utf-8')) for i, line in enumerate(line for line in stderr.split('\n') if line): indent = 0 if i == 0 else 7 print(_prettify(line, indent)) + if re.search(r"\berror\b", line, re.IGNORECASE): + found_error = True + if rc == RC_MISCONFIGURATION and not found_error: + rc = 1 return rc diff --git a/test/features/cluster_api.feature b/test/features/cluster_api.feature index 7c9a2a581..57447e024 100644 --- a/test/features/cluster_api.feature +++ b/test/features/cluster_api.feature @@ -162,7 +162,7 @@ Feature: Functional test to cover SAP clusterAPI When Run "crm -F configure primitive d-require-fence Dummy meta requires=fencing" on "hanode1" When Try "crm configure verify" - Then Expected return code is "1" + Then Expected return code is "0" Then Expected "Configuration invalid (with warnings)" in stdout When Try "crm -F configure primitive d-unknown-param Dummy params xxx=xxx"