Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crmsh/cibverify.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
2 changes: 1 addition & 1 deletion test/features/cluster_api.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution that after pacemaker#3933 this will be changed to "Configuration may need attention"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we update the test case after pacemaker upgraded

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this,

Suggested change
Then Expected "Configuration invalid (with warnings)" in stdout
Then Expect stdout contains snippets ["Configuration invalid (with warnings)", "Configuration may need attention"]

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can hold on to this PR, until pacemaker#3933 submits to Factory


When Try "crm -F configure primitive d-unknown-param Dummy params xxx=xxx"
Expand Down