From f78cb3be9ef979e0e377dbbb30983e906cba436d Mon Sep 17 00:00:00 2001 From: Klaus Wenninger Date: Wed, 15 Sep 2021 11:59:11 +0200 Subject: [PATCH] * Wed Sep 15 2021 Klaus Wenninger - 2.1.1-9 - allow xml-testing without rng in cts-fencing - merged in upstream spec-changes --- ...-fencing-add-a-few-options-for-tests.patch | 121 ++++++++++++++++++ pacemaker.spec | 13 +- 2 files changed, 131 insertions(+), 3 deletions(-) create mode 100644 0008-Test-cts-fencing-add-a-few-options-for-tests.patch diff --git a/0008-Test-cts-fencing-add-a-few-options-for-tests.patch b/0008-Test-cts-fencing-add-a-few-options-for-tests.patch new file mode 100644 index 0000000..c8a4c88 --- /dev/null +++ b/0008-Test-cts-fencing-add-a-few-options-for-tests.patch @@ -0,0 +1,121 @@ +From 4ff5788e564bc5e76f87d0ab6b00501d57f68fad Mon Sep 17 00:00:00 2001 +From: Klaus Wenninger +Date: Thu, 19 Aug 2021 16:51:49 +0200 +Subject: [PATCH] Test: cts-fencing: add a few options for tests + +allow pure xml validity-check without checking against rng-file +allow discarding stdout for checks +add exception-handler for xmllint errors +--- + cts/cts-fencing.in | 30 +++++++++++++++++++++--------- + 1 file changed, 21 insertions(+), 9 deletions(-) + +diff --git a/cts/cts-fencing.in b/cts/cts-fencing.in +index c4697ee..942e607 100644 +--- a/cts/cts-fencing.in ++++ b/cts/cts-fencing.in +@@ -109,7 +109,10 @@ def update_path(): + + def find_validator(rng_file): + if os.access("/usr/bin/xmllint", os.X_OK): +- return ["xmllint", "--relaxng", rng_file, "-"] ++ if rng_file == None: ++ return ["xmllint", "-"] ++ else: ++ return ["xmllint", "--relaxng", rng_file, "-"] + else: + return None + +@@ -123,7 +126,7 @@ def rng_directory(): + return SCHEMA_DIR + + +-def pipe_communicate(pipes, stderr=False, stdin=None): ++def pipe_communicate(pipes, check_stderr=False, stdin=None): + """ Get text output from pipes """ + + if stdin is not None: +@@ -132,7 +135,7 @@ def pipe_communicate(pipes, stderr=False, stdin=None): + pipe_outputs = pipes.communicate() + + output = pipe_outputs[0].decode(sys.stdout.encoding) +- if stderr: ++ if check_stderr: + output = output + pipe_outputs[1].decode(sys.stderr.encoding) + return output + +@@ -240,7 +243,7 @@ class Test(object): + + self.executed = 0 + +- def __new_cmd(self, cmd, args, exitcode, stdout_match="", no_wait=0, stdout_negative_match="", kill=None, validate=True): ++ def __new_cmd(self, cmd, args, exitcode, stdout_match="", no_wait=0, stdout_negative_match="", kill=None, validate=True, check_rng=True, check_stderr=True): + """ Add a command to be executed as part of this test """ + + self.cmds.append( +@@ -253,6 +256,8 @@ class Test(object): + "stdout_negative_match" : stdout_negative_match, + "no_wait" : no_wait, + "validate" : validate, ++ "check_rng" : check_rng, ++ "check_stderr" : check_stderr, + } + ) + +@@ -347,10 +352,10 @@ class Test(object): + + self.negative_stonith_patterns.append(pattern) + +- def add_cmd(self, cmd, args, validate=True): ++ def add_cmd(self, cmd, args, validate=True, check_rng=True, check_stderr=True): + """ Add a simple command to be executed as part of this test """ + +- self.__new_cmd(cmd, args, CrmExit.OK, "", validate=validate) ++ self.__new_cmd(cmd, args, CrmExit.OK, "", validate=validate, check_rng=check_rng, check_stderr=check_stderr) + + def add_cmd_no_wait(self, cmd, args): + """ Add a simple command to be executed (without waiting) as part of this test """ +@@ -397,7 +402,7 @@ class Test(object): + else: + return CrmExit.OK + +- output = pipe_communicate(test, stderr=True) ++ output = pipe_communicate(test, check_stderr=args['check_stderr']) + if self.verbose: + print(output) + +@@ -413,7 +418,10 @@ class Test(object): + raise OutputFoundError(output) + + if args['validate']: +- rng_file = rng_directory() + "/api/api-result.rng" ++ if args['check_rng']: ++ rng_file = rng_directory() + "/api/api-result.rng" ++ else: ++ rng_file = None + + cmd = find_validator(rng_file) + if not cmd: +@@ -423,7 +431,7 @@ class Test(object): + print("\nRunning: "+" ".join(cmd)) + + validator = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) +- output = pipe_communicate(validator, stderr=True, stdin=output) ++ output = pipe_communicate(validator, check_stderr=True, stdin=output) + + if self.verbose: + print(output) +@@ -508,6 +516,10 @@ class Test(object): + print("Step %d FAILED - '%s' was found in command output: %s" % (i, cmd['stdout_negative_match'], e)) + self.set_error(i, cmd); + break ++ except XmlValidationError as e: ++ print("Step %d FAILED - xmllint failed: %s" % (i, e)) ++ self.set_error(i, cmd); ++ break + if self.verbose: + print("Step %d SUCCESS" % (i)) + i = i + 1 +-- +1.8.3.1 + diff --git a/pacemaker.spec b/pacemaker.spec index 5bc62a5..07f72df 100644 --- a/pacemaker.spec +++ b/pacemaker.spec @@ -32,7 +32,7 @@ ## can be incremented to build packages reliably considered "newer" ## than previously built packages with the same pcmkversion) %global pcmkversion 2.1.1 -%global specversion 8 +%global specversion 9 ## Upstream commit (full commit ID, abbreviated commit ID, or tag) to build %global commit 77db57872790c73e44ee7f49005d3ee1dded652e @@ -222,6 +222,7 @@ Patch3: 0004-Build-rpm-package-fence_watchdog-in-base-package.patch Patch6: 0005-Fix-fence_watchdog-fix-malformed-xml-in-metadata.patch Patch7: 0006-Test-cts-fencing-Add-a-test-for-metadata.patch Patch8: 0007-Test-cts-fencing-check-metadata-from-fence_dummy-wat.patch +Patch9: 0008-Test-cts-fencing-add-a-few-options-for-tests.patch # upstream commits @@ -254,16 +255,18 @@ BuildRequires: findutils BuildRequires: gcc BuildRequires: grep BuildRequires: libtool -BuildRequires: make %if %{defined pkgname_libtool_devel} BuildRequires: %{?pkgname_libtool_devel} %endif +BuildRequires: make BuildRequires: pkgconfig BuildRequires: sed # Required for core functionality BuildRequires: pkgconfig(glib-2.0) >= 2.42 -BuildRequires: libxml2-devel libxslt-devel libuuid-devel +BuildRequires: libxml2-devel +BuildRequires: libxslt-devel +BuildRequires: libuuid-devel BuildRequires: %{pkgname_bzip2_devel} # Enables optional functionality @@ -830,6 +833,10 @@ exit 0 %license %{nagios_name}-%{nagios_hash}/COPYING %changelog +* Wed Sep 15 2021 Klaus Wenninger - 2.1.1-9 +- allow xml-testing without rng in cts-fencing +- merged in upstream spec-changes + * Mon Sep 13 2021 Klaus Wenninger - 2.1.1-8 - added test for getting metadata via stonith_admin