107 lines
3.5 KiB
Diff
107 lines
3.5 KiB
Diff
From 81cefe083678b88ca475c0d3f0eea962ed3a5035 Mon Sep 17 00:00:00 2001
|
|
From: bizhiyuan <bizhiyuan@kylinos.cn>
|
|
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
|
|
|