From 2703130a5601c5d24e6b0e911081058968c5dc15 Mon Sep 17 00:00:00 2001 From: bizhiyuan Date: Sun, 6 Aug 2023 03:28:43 +0800 Subject: [PATCH 1/4] Adjust regex to support rubygem-json-2.6.3 error --- ...st-regex-to-support-json-2.6.3-error.patch | 34 +++++++++++++++++++ pcs.spec | 7 ++-- 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 Adjust-regex-to-support-json-2.6.3-error.patch diff --git a/Adjust-regex-to-support-json-2.6.3-error.patch b/Adjust-regex-to-support-json-2.6.3-error.patch new file mode 100644 index 0000000..1fc1ccb --- /dev/null +++ b/Adjust-regex-to-support-json-2.6.3-error.patch @@ -0,0 +1,34 @@ +From 92f0b7927577e190137a466ffeb4ae06c428efcd Mon Sep 17 00:00:00 2001 +From: bizhiyuan +Date: Sun, 6 Aug 2023 01:12:21 +0800 +Subject: [PATCH] Adjust regex to support json2.6.3 error + +--- + pcsd/test/test_config.rb | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/pcsd/test/test_config.rb b/pcsd/test/test_config.rb +index 7aaf434..a580b24 100644 +--- a/pcsd/test/test_config.rb ++++ b/pcsd/test/test_config.rb +@@ -126,7 +126,7 @@ class TestConfig < Test::Unit::TestCase + assert_equal('error', $logger.log[0][0]) + assert_match( + # the number is based on JSON gem version +- /Unable to parse pcs_settings file: \d+: unexpected token/, ++ /Unable to parse pcs_settings file: (\d+: )?unexpected token/, + $logger.log[0][1] + ) + assert_equal(fixture_empty_config, cfg.text) +@@ -723,7 +723,7 @@ class TestCfgKnownHosts < Test::Unit::TestCase + assert_equal('error', $logger.log[0][0]) + assert_match( + # the number is based on JSON gem version +- /Unable to parse known-hosts file: \d+: unexpected token/, ++ /Unable to parse known-hosts file: (\d+: )?unexpected token/, + $logger.log[0][1] + ) + assert_empty_data(cfg) +-- +2.27.0 + diff --git a/pcs.spec b/pcs.spec index 2cc4bba..6bbde61 100644 --- a/pcs.spec +++ b/pcs.spec @@ -1,6 +1,6 @@ Name: pcs Version: 0.11.2 -Release: 1 +Release: 2 License: GPLv2 and BSD-2-Clause and ASL 2.0 and MIT URL: https://github.com/ClusterLabs/pcs Summary: Pacemaker Configuration System @@ -40,7 +40,7 @@ Patch0: simplify-ternar-expression.patch Patch1: fix-backend-parameter-all-in-cluster-destroy.patch Patch2: bz2093935-01-Python-3.11-related-fixes.patch Patch3: Support-for-openEuler.patch - +Patch4: Adjust-regex-to-support-json-2.6.3-error.patch # git for patches BuildRequires: git-core BuildRequires: make @@ -403,6 +403,9 @@ run_all_tests %license pyagentx_LICENSE.txt %changelog +* Mon Aug 07 2023 bizhiyuan - 0.11.2-2 +- Adjust regex pattern for ruby to support json 2.6.3 build error + * Mon Feb 06 2023 jiangxinyu - 0.11.2-1 - Update package to version 0.11.2 -- Gitee From baa1a768c9ed206701191e33f2f0043ff8e23491 Mon Sep 17 00:00:00 2001 From: jxy_git Date: Wed, 23 Aug 2023 17:21:07 +0800 Subject: [PATCH 2/4] Fix typing in resource_agent package (cherry picked from commit f1b28218ff9ebfee2c02cb278fc3090fa5524938) --- Fix-typing-in-resource_agent-package.patch | 147 +++++++++++++++++++++ pcs.spec | 6 +- 2 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 Fix-typing-in-resource_agent-package.patch diff --git a/Fix-typing-in-resource_agent-package.patch b/Fix-typing-in-resource_agent-package.patch new file mode 100644 index 0000000..e483d71 --- /dev/null +++ b/Fix-typing-in-resource_agent-package.patch @@ -0,0 +1,147 @@ +From 5fe9bf04c46bfcbb4008d8d2a51b74c6c1693ec3 Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Tue, 22 Aug 2023 18:25:34 +0800 +Subject: [PATCH] Fix typing in resource_agent package + +--- + mypy.ini | 10 +++++----- + pcs/lib/resource_agent/error.py | 4 ++-- + pcs/lib/resource_agent/facade.py | 12 +++++++----- + pcs/lib/resource_agent/types.py | 4 ++-- + 4 files changed, 16 insertions(+), 14 deletions(-) + +diff --git a/mypy.ini b/mypy.ini +index f34b513..a3f7d07 100644 +--- a/mypy.ini ++++ b/mypy.ini +@@ -48,19 +48,19 @@ disallow_untyped_defs = True + # this is a temporary solution for legacy code + disallow_untyped_defs = False + +-[mypy-pcs.common.ssl] ++[mypy-pcs.common.services.*] + disallow_untyped_defs = True + disallow_untyped_calls = True + +-[mypy-pcs.common.types] ++[mypy-pcs.common.ssl] + disallow_untyped_defs = True + disallow_untyped_calls = True + +-[mypy-pcs.common.validate] ++[mypy-pcs.common.types] + disallow_untyped_defs = True + disallow_untyped_calls = True + +-[mypy-pcs.common.services.*] ++[mypy-pcs.common.validate] + disallow_untyped_defs = True + disallow_untyped_calls = True + +@@ -113,7 +113,7 @@ disallow_untyped_defs = True + disallow_untyped_defs = True + disallow_untyped_calls = True + +-[mypy-pcs.lib.resource_agent] ++[mypy-pcs.lib.resource_agent.*] + disallow_untyped_defs = True + disallow_untyped_calls = True + +diff --git a/pcs/lib/resource_agent/error.py b/pcs/lib/resource_agent/error.py +index d417833..f61f196 100644 +--- a/pcs/lib/resource_agent/error.py ++++ b/pcs/lib/resource_agent/error.py +@@ -17,13 +17,13 @@ class AgentNameGuessFoundMoreThanOne(ResourceAgentError): + self.names_found = names_found + + @property +- def searched_name(self): ++ def searched_name(self) -> str: + return self.agent_name + + + class AgentNameGuessFoundNone(ResourceAgentError): + @property +- def searched_name(self): ++ def searched_name(self) -> str: + return self.agent_name + + +diff --git a/pcs/lib/resource_agent/facade.py b/pcs/lib/resource_agent/facade.py +index 4dbb59b..d5a28f3 100644 +--- a/pcs/lib/resource_agent/facade.py ++++ b/pcs/lib/resource_agent/facade.py +@@ -1,6 +1,6 @@ + from collections import defaultdict + from dataclasses import replace as dc_replace +-from typing import Dict, Iterable, List, Optional, Set ++from typing import Dict, Iterable, List, Optional, Set, cast + + from pcs.common import reports + from pcs.lib import validate +@@ -12,6 +12,7 @@ from .name import name_to_void_metadata + from .ocf_transform import ocf_version_to_ocf_unified + from .pcs_transform import get_additional_trace_parameters, ocf_unified_to_pcs + from .types import ( ++ FakeAgentName, + ResourceAgentMetadata, + ResourceAgentName, + ResourceAgentParameter, +@@ -154,7 +155,7 @@ class ResourceAgentFacade: + return validators + + @property +- def _validator_option_type(self): ++ def _validator_option_type(self) -> str: + return "stonith" if self.metadata.name.is_stonith else "resource" + + def _get_all_params_deprecated_by(self) -> Dict[str, Set[str]]: +@@ -185,7 +186,7 @@ class ResourceAgentFacadeFactory: + ) -> None: + self._runner = runner + self._report_processor = report_processor +- self._fenced_metadata = None ++ self._fenced_metadata: Optional[ResourceAgentMetadata] = None + + def facade_from_parsed_name( + self, name: ResourceAgentName +@@ -226,7 +227,7 @@ class ResourceAgentFacadeFactory: + ) + return ResourceAgentFacade(metadata, additional_parameters) + +- def _get_fenced_parameters(self): ++ def _get_fenced_parameters(self) -> List[ResourceAgentParameter]: + if self._fenced_metadata is None: + agent_name = ResourceAgentName( + const.FAKE_AGENT_STANDARD, None, const.PACEMAKER_FENCED +@@ -237,7 +238,8 @@ class ResourceAgentFacadeFactory: + parse_metadata( + agent_name, + load_fake_agent_metadata( +- self._runner, agent_name.type ++ self._runner, ++ cast(FakeAgentName, agent_name.type), + ), + ) + ) +diff --git a/pcs/lib/resource_agent/types.py b/pcs/lib/resource_agent/types.py +index ffa5a51..d045e01 100644 +--- a/pcs/lib/resource_agent/types.py ++++ b/pcs/lib/resource_agent/types.py +@@ -26,11 +26,11 @@ class ResourceAgentName: + return ":".join(filter(None, [self.standard, self.provider, self.type])) + + @property +- def is_pcmk_fake_agent(self): ++ def is_pcmk_fake_agent(self) -> bool: + return self.standard == _FAKE_AGENT_STANDARD + + @property +- def is_stonith(self): ++ def is_stonith(self) -> bool: + return self.standard == "stonith" + + def to_dto(self) -> ResourceAgentNameDto: +-- +2.41.0 + diff --git a/pcs.spec b/pcs.spec index 6bbde61..059c4c9 100644 --- a/pcs.spec +++ b/pcs.spec @@ -1,6 +1,6 @@ Name: pcs Version: 0.11.2 -Release: 2 +Release: 3 License: GPLv2 and BSD-2-Clause and ASL 2.0 and MIT URL: https://github.com/ClusterLabs/pcs Summary: Pacemaker Configuration System @@ -41,6 +41,7 @@ Patch1: fix-backend-parameter-all-in-cluster-destroy.patch Patch2: bz2093935-01-Python-3.11-related-fixes.patch Patch3: Support-for-openEuler.patch Patch4: Adjust-regex-to-support-json-2.6.3-error.patch +Patch5: Fix-typing-in-resource_agent-package.patch # git for patches BuildRequires: git-core BuildRequires: make @@ -403,6 +404,9 @@ run_all_tests %license pyagentx_LICENSE.txt %changelog +* Wed Aug 23 2023 jiangxinyu - 0.11.2-3 +- Fix typing in resource_agent package + * Mon Aug 07 2023 bizhiyuan - 0.11.2-2 - Adjust regex pattern for ruby to support json 2.6.3 build error -- Gitee From 6e497eb43d0f880d0d052764fe22344298d17745 Mon Sep 17 00:00:00 2001 From: bizhiyuan Date: Thu, 31 Aug 2023 04:42:22 +0800 Subject: [PATCH 3/4] fix pcs config checkpoint diff command (cherry picked from commit ec69f74b0e38aa76c657b03f9bd084eab87df8dd) --- fix-pcs-config-checkpoint-diff-command.patch | 106 +++++++++++++++++++ pcs.spec | 7 +- 2 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 fix-pcs-config-checkpoint-diff-command.patch diff --git a/fix-pcs-config-checkpoint-diff-command.patch b/fix-pcs-config-checkpoint-diff-command.patch new file mode 100644 index 0000000..00ce964 --- /dev/null +++ b/fix-pcs-config-checkpoint-diff-command.patch @@ -0,0 +1,106 @@ +From 81cefe083678b88ca475c0d3f0eea962ed3a5035 Mon Sep 17 00:00:00 2001 +From: bizhiyuan +Date: Thu, 31 Aug 2023 04:25:52 +0800 +Subject: [PATCH] fix pcs config checkpoint diff command + +--- + CHANGELOG.md | 5 ++++- + pcs/cli/common/lib_wrapper.py | 13 +------------ + pcs/config.py | 3 +++ + 3 files changed, 8 insertions(+), 13 deletions(-) + +diff --git a/CHANGELOG.md b/CHANGELOG.md +index 9741670..7949064 100644 +--- a/CHANGELOG.md ++++ b/CHANGELOG.md +@@ -15,6 +15,9 @@ + - Multiple improvements of `pcs resource move` command ([rhbz#1996062]) + - Pcs no longer creates Pacemaker-1.x CIB when `-f` is used, so running `pcs + cluster cib-upgrade` manually is not needed ([rhbz#2022463]) ++- Fix displaying differences between configuration checkpoints in ++ `pcs config checkpoint diff` command ([rhbz#2175881]) ++ + + [ghissue#441]: https://github.com/ClusterLabs/pcs/issues/441 + [ghpull#431]: https://github.com/ClusterLabs/pcs/pull/431 +@@ -24,7 +27,7 @@ + [rhbz#2028902]: https://bugzilla.redhat.com/show_bug.cgi?id=2028902 + [rhbz#2033248]: https://bugzilla.redhat.com/show_bug.cgi?id=2033248 + [rhbz#2036633]: https://bugzilla.redhat.com/show_bug.cgi?id=2036633 +- ++[rhbz#2175881]: https://bugzilla.redhat.com/show_bug.cgi?id=2175881 + + ## [0.11.1] - 2021-11-30 + +diff --git a/pcs/cli/common/lib_wrapper.py b/pcs/cli/common/lib_wrapper.py +index 6600497..c6c9dba 100644 +--- a/pcs/cli/common/lib_wrapper.py ++++ b/pcs/cli/common/lib_wrapper.py +@@ -1,6 +1,5 @@ + import logging + from collections import namedtuple +-from typing import Dict, Any + + from pcs.cli.common import middleware + from pcs.lib.commands import ( +@@ -34,10 +33,6 @@ from pcs.lib.commands.constraint import ( + from pcs.lib.env import LibraryEnvironment + + +-# Note: not properly typed +-_CACHE: Dict[Any, Any] = {} +- +- + def wrapper(dictionary): + return namedtuple("wrapper", dictionary.keys())(**dictionary) + +@@ -104,12 +99,6 @@ def bind_all(env, run_with_middleware, dictionary): + ) + + +-def get_module(env, middleware_factory, name): +- if name not in _CACHE: +- _CACHE[name] = load_module(env, middleware_factory, name) +- return _CACHE[name] +- +- + def load_module(env, middleware_factory, name): + # pylint: disable=too-many-return-statements, too-many-branches + if name == "acl": +@@ -518,4 +507,4 @@ class Library: + self.middleware_factory = middleware_factory + + def __getattr__(self, name): +- return get_module(self.env, self.middleware_factory, name) ++ return load_module(self.env, self.middleware_factory, name) +diff --git a/pcs/config.py b/pcs/config.py +index 32f6a50..83884ec 100644 +--- a/pcs/config.py ++++ b/pcs/config.py +@@ -678,6 +678,7 @@ def _checkpoint_to_lines(lib, checkpoint_number): + orig_usefile = utils.usefile + orig_filename = utils.filename + orig_middleware = lib.middleware_factory ++ orig_env = lib.env + # configure old code to read the CIB from a file + utils.usefile = True + utils.filename = os.path.join( +@@ -687,6 +688,7 @@ def _checkpoint_to_lines(lib, checkpoint_number): + lib.middleware_factory = orig_middleware._replace( + cib=middleware.cib(utils.filename, utils.touch_cib_file) + ) ++ lib.env = utils.get_cli_env() + # export the CIB to text + result = False, [] + if os.path.isfile(utils.filename): +@@ -695,6 +697,7 @@ def _checkpoint_to_lines(lib, checkpoint_number): + utils.usefile = orig_usefile + utils.filename = orig_filename + lib.middleware_factory = orig_middleware ++ lib.env = orig_env + return result + + +-- +2.27.0 + diff --git a/pcs.spec b/pcs.spec index 059c4c9..700a1fc 100644 --- a/pcs.spec +++ b/pcs.spec @@ -1,6 +1,6 @@ Name: pcs Version: 0.11.2 -Release: 3 +Release: 4 License: GPLv2 and BSD-2-Clause and ASL 2.0 and MIT URL: https://github.com/ClusterLabs/pcs Summary: Pacemaker Configuration System @@ -42,6 +42,8 @@ Patch2: bz2093935-01-Python-3.11-related-fixes.patch Patch3: Support-for-openEuler.patch Patch4: Adjust-regex-to-support-json-2.6.3-error.patch Patch5: Fix-typing-in-resource_agent-package.patch +Patch6: fix-pcs-config-checkpoint-diff-command.patch + # git for patches BuildRequires: git-core BuildRequires: make @@ -404,6 +406,9 @@ run_all_tests %license pyagentx_LICENSE.txt %changelog +* Thu Aug 31 2023 bizhiyuan - 0.11.2-4 +- Fix pcs config checkpoint diff command + * Wed Aug 23 2023 jiangxinyu - 0.11.2-3 - Fix typing in resource_agent package -- Gitee From e54ecacbef722ff6db0ee17197c9e6f30524258e Mon Sep 17 00:00:00 2001 From: zouzhimin Date: Mon, 4 Sep 2023 18:32:11 +0800 Subject: [PATCH 4/4] fix pcs quorum device remove --- fix-pcs-quorum-device-remove.patch | 25 +++++++++++++++++++++++++ pcs.spec | 8 ++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 fix-pcs-quorum-device-remove.patch diff --git a/fix-pcs-quorum-device-remove.patch b/fix-pcs-quorum-device-remove.patch new file mode 100644 index 0000000..45b079f --- /dev/null +++ b/fix-pcs-quorum-device-remove.patch @@ -0,0 +1,25 @@ +From 0b2dc6cc49715d8ae006b9f6877324e76ea9a271 Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Mon, 4 Sep 2023 18:20:31 +0800 +Subject: [PATCH] fix pcs quorum device remove + +--- + pcsd/remote.rb | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pcsd/remote.rb b/pcsd/remote.rb +index 9dabdd0..ed5f347 100644 +--- a/pcsd/remote.rb ++++ b/pcsd/remote.rb +@@ -1987,7 +1987,7 @@ def qdevice_net_client_destroy(param, request, auth_user) + end + stdout, stderr, retval = run_cmd( + auth_user, +- PCS, '--' 'qdevice', 'net-client', 'destroy' ++ PCS, '--', 'qdevice', 'net-client', 'destroy' + ) + if retval != 0 + return [400, stderr.join('')] +-- +2.39.1 + diff --git a/pcs.spec b/pcs.spec index 700a1fc..8c0fb9d 100644 --- a/pcs.spec +++ b/pcs.spec @@ -1,6 +1,6 @@ Name: pcs Version: 0.11.2 -Release: 4 +Release: 5 License: GPLv2 and BSD-2-Clause and ASL 2.0 and MIT URL: https://github.com/ClusterLabs/pcs Summary: Pacemaker Configuration System @@ -43,7 +43,8 @@ Patch3: Support-for-openEuler.patch Patch4: Adjust-regex-to-support-json-2.6.3-error.patch Patch5: Fix-typing-in-resource_agent-package.patch Patch6: fix-pcs-config-checkpoint-diff-command.patch - +#https://github.com/ClusterLabs/pcs/pull/522 +Patch7: fix-pcs-quorum-device-remove.patch # git for patches BuildRequires: git-core BuildRequires: make @@ -406,6 +407,9 @@ run_all_tests %license pyagentx_LICENSE.txt %changelog +* Tue Sep 05 2023 zouzhimin - 0.11.2-5 +- Fix pcs quorum device remove + * Thu Aug 31 2023 bizhiyuan - 0.11.2-4 - Fix pcs config checkpoint diff command -- Gitee