!55 update to 0.11.7

From: @xiangbudaomz 
Reviewed-by: @jxy_git 
Signed-off-by: @jxy_git
This commit is contained in:
openeuler-ci-bot 2024-02-29 08:24:27 +00:00 committed by Gitee
commit bfcc5c9b0a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
23 changed files with 119 additions and 1169 deletions

View File

@ -1,34 +0,0 @@
From 92f0b7927577e190137a466ffeb4ae06c428efcd Mon Sep 17 00:00:00 2001
From: bizhiyuan <bizhiyuan@kylinos.cn>
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

View File

@ -1,56 +0,0 @@
From 32d90eab80ee957350c4c218ecf7ed5ac7efc7d0 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Thu, 19 Oct 2023 16:54:43 +0800
Subject: [PATCH] FIX CVE-2022-1049
---
CHANGELOG.md | 4 +++-
pcs/daemon/auth.py | 3 +++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7949064..c6007ac 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,7 +17,8 @@
cluster cib-upgrade` manually is not needed ([rhbz#2022463])
- Fix displaying differences between configuration checkpoints in
`pcs config checkpoint diff` command ([rhbz#2175881])
-
+- Pcs daemon was allowing expired accounts, and accounts with expired
+ passwords to login when using PAM auth. ([huntr#220307])
[ghissue#441]: https://github.com/ClusterLabs/pcs/issues/441
[ghpull#431]: https://github.com/ClusterLabs/pcs/pull/431
@@ -28,6 +29,7 @@
[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
+[huntr#220307]: https://huntr.dev/bounties/7aa921fc-a568-4fd8-96f4-7cd826246aa5/
## [0.11.1] - 2021-11-30
diff --git a/pcs/daemon/auth.py b/pcs/daemon/auth.py
index 592aa63..1ae2ed2 100644
--- a/pcs/daemon/auth.py
+++ b/pcs/daemon/auth.py
@@ -52,6 +52,7 @@ libpam = CDLL(find_library("pam"))
strdup = prep_fn(libc.strdup, POINTER(c_char), [c_char_p])
calloc = prep_fn(libc.calloc, c_void_p, [c_uint, c_uint])
pam_authenticate = prep_fn(libpam.pam_authenticate, c_int, [pam_handle, c_int])
+pam_acct_mgmt = prep_fn(libpam.pam_acct_mgmt, c_int, [pam_handle, c_int])
pam_end = prep_fn(libpam.pam_end, c_int, [pam_handle, c_int])
pam_start = prep_fn(
libpam.pam_start,
@@ -90,6 +91,8 @@ def authenticate_by_pam(username, password):
)
if returncode == PAM_SUCCESS:
returncode = pam_authenticate(pamh, 0)
+ if returncode == PAM_SUCCESS:
+ returncode = pam_acct_mgmt(pamh, 0)
pam_end(pamh, returncode)
return returncode == PAM_SUCCESS
--
2.27.0

View File

@ -1,46 +0,0 @@
From c44b3139334dc6f132d73e0771b0e3254756df20 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Thu, 19 Oct 2023 17:02:43 +0800
Subject: [PATCH] Fix CVE-2022-2735
---
pcsd/rserver.rb | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/pcsd/rserver.rb b/pcsd/rserver.rb
index e2c5e2a..4fde639 100644
--- a/pcsd/rserver.rb
+++ b/pcsd/rserver.rb
@@ -7,6 +7,29 @@ require 'thin'
require 'settings.rb'
+# Replace Thin::Backends::UnixServer:connect
+# The only change is 'File.umask(0o777)' instead of 'File.umask(0)' to properly
+# set python-ruby socket permissions
+module Thin
+ module Backends
+ class UnixServer < Base
+ def connect
+ at_exit { remove_socket_file } # In case it crashes
+ old_umask = File.umask(0o077)
+ begin
+ EventMachine.start_unix_domain_server(@socket, UnixConnection, &method(:initialize_connection))
+ # HACK EventMachine.start_unix_domain_server doesn't return the connection signature
+ # so we have to go in the internal stuff to find it.
+ @signature = EventMachine.instance_eval{@acceptors.keys.first}
+ ensure
+ File.umask(old_umask)
+ end
+ end
+ end
+ end
+end
+
+
def pack_response(response)
return [200, {}, [response.to_json.to_str]]
end
--
2.27.0

View File

@ -1,147 +0,0 @@
From 5fe9bf04c46bfcbb4008d8d2a51b74c6c1693ec3 Mon Sep 17 00:00:00 2001
From: rpm-build <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

View File

@ -1,6 +1,6 @@
From b26bd40e94272e5d0d6cb985d42e0f8794ea5d5f Mon Sep 17 00:00:00 2001
From 3a9534a997237c52783f9b668a18f585e618cd52 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Wed, 8 Feb 2023 10:43:57 +0800
Date: Wed, 6 Dec 2023 06:26:32 +0800
Subject: [PATCH] Support for openEuler
---
@ -11,34 +11,34 @@ Subject: [PATCH] Support for openEuler
create mode 100644 pcsd/pam/pcsd.openEuler
diff --git a/configure.ac b/configure.ac
index a677a53..eaaedae 100644
index 20db079..68de52c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -217,6 +217,15 @@ for i in $DISTRO $DISTROS; do
DISTROEXT=fedora
@@ -258,6 +258,15 @@ for i in $DISTRO $DISTROS; do
DISTROEXT=opencloudos
break
;;
+ openEuler)
+ FOUND_DISTRO=1
+ CONFIGDIR="$sysconfdir/sysconfig"
+ PCSLIBDIR="$LIBDIR"
+ PCMKDAEMONDIR="$prefix/libexec/pacemaker"
+ COROSYNCLOGDIR="$localstatedir/log/cluster"
+ DISTROEXT=openEuler
+ break
+ ;;
+ openEuler)
+ FOUND_DISTRO=1
+ CONFIGDIR="$sysconfdir/sysconfig"
+ PCSLIBDIR="$LIBDIR"
+ PCMKDAEMONDIR="$prefix/libexec/pacemaker"
+ COROSYNCLOGDIR="$localstatedir/log/cluster"
+ DISTROEXT=openEuler
+ break
+ ;;
esac
done
diff --git a/pcsd/Makefile.am b/pcsd/Makefile.am
index a16917f..add8880 100644
index fb8b116..ac65bef 100644
--- a/pcsd/Makefile.am
+++ b/pcsd/Makefile.am
@@ -1,6 +1,7 @@
EXTRA_DIST = \
@@ -2,6 +2,7 @@ EXTRA_DIST = \
pam/pcsd.debian \
pam/pcsd.fedora \
+ pam/pcsd.openEuler \
pam/pcsd.opencloudos \
+ pam/pcsd.openEuler \
test/cib1.xml \
test/corosync.conf \
test/crm1.xml \
@ -54,5 +54,5 @@ index 0000000..fcb7a46
+password include system-auth
+session include system-auth
--
2.33.0
2.41.0

View File

@ -1,70 +0,0 @@
From 5666877a0fe2cb9d99b1bca82d2d531887c22e4e Mon Sep 17 00:00:00 2001
From: Miroslav Lisik <mlisik@redhat.com>
Date: Wed, 8 Jun 2022 16:57:29 +0200
Subject: [PATCH] Python 3.11 related fixes
fix test_failed function in test tools
fix enum value in test fixture
fix test case mocking
---
pcs_test/tier0/cli/test_nvset.py | 3 ++-
pcs_test/tier0/lib/commands/test_ticket.py | 2 +-
pcs_test/tools/case_analysis.py | 13 ++++++-------
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/pcs_test/tier0/cli/test_nvset.py b/pcs_test/tier0/cli/test_nvset.py
index 93a96e7a..ad44f2a1 100644
--- a/pcs_test/tier0/cli/test_nvset.py
+++ b/pcs_test/tier0/cli/test_nvset.py
@@ -149,7 +149,8 @@ class NvsetDtoListToLines(TestCase):
def fixture_dto_list(self):
return [
- self.fixture_dto(in_effect) for in_effect in CibRuleInEffectStatus
+ self.fixture_dto(in_effect.value)
+ for in_effect in CibRuleInEffectStatus
]
def test_expired_included(self):
diff --git a/pcs_test/tier0/lib/commands/test_ticket.py b/pcs_test/tier0/lib/commands/test_ticket.py
index 5459582a..3e7b7310 100644
--- a/pcs_test/tier0/lib/commands/test_ticket.py
+++ b/pcs_test/tier0/lib/commands/test_ticket.py
@@ -95,7 +95,7 @@ class CreateTest(TestCase):
)
-@patch_commands("get_constraints", mock.Mock)
+@patch_commands("get_constraints", mock.Mock())
class RemoveTest(TestCase):
@patch_commands("ticket.remove_plain", mock.Mock(return_value=1))
@patch_commands(
diff --git a/pcs_test/tools/case_analysis.py b/pcs_test/tools/case_analysis.py
index 49fd1ee8..6d311548 100644
--- a/pcs_test/tools/case_analysis.py
+++ b/pcs_test/tools/case_analysis.py
@@ -10,15 +10,14 @@ def _list2reason(test, exc_list):
def test_failed(test):
# Borrowed from
# https://stackoverflow.com/questions/4414234/getting-pythons-unittest-results-in-a-teardown-method/39606065#39606065
- # for Python versions 2.7 to 3.6
- if hasattr(test, "_outcome"): # Python 3.4+
- # these 2 methods have no side effects
+ # for Python versions 3.4 to 3.11
+ if hasattr(test._outcome, "errors"):
+ # Python 3.4 - 3.10 (These 2 methods have no side effects)
result = test.defaultTestResult()
test._feedErrorsToResult(result, test._outcome.errors)
- else: # Python 3.2 - 3.3 or 3.0 - 3.1 and 2.7
- result = getattr(
- test, "_outcomeForDoCleanups", test._resultForDoCleanups
- )
+ else:
+ # Python 3.11+
+ result = test._outcome.result
return _list2reason(test, result.errors) or _list2reason(
test, result.failures
--
2.35.3

Binary file not shown.

BIN
dacite-1.8.1.tar.gz Normal file

Binary file not shown.

View File

@ -0,0 +1,38 @@
From cf1e0cc06a94804a4a98a12ee06d09e5786bad1b Mon Sep 17 00:00:00 2001
From: Ivan Devat <idevat@redhat.com>
Date: Tue, 20 Nov 2018 15:03:56 +0100
Subject: [PATCH] do not support cluster setup with udp(u) transport in RHEL9
---
pcs/pcs.8.in | 2 ++
pcs/usage.py | 1 +
2 files changed, 3 insertions(+)
diff --git a/pcs/pcs.8.in b/pcs/pcs.8.in
index 55f4b4a9..8cc9360d 100644
--- a/pcs/pcs.8.in
+++ b/pcs/pcs.8.in
@@ -479,6 +479,8 @@ By default, encryption is enabled with cipher=aes256 and hash=sha256. To disable
Transports udp and udpu:
.br
+WARNING: These transports are not supported in RHEL 9.
+.br
These transports are limited to one address per node. They do not support traffic encryption nor compression.
.br
Transport options are: ip_version, netmtu
diff --git a/pcs/usage.py b/pcs/usage.py
index cc6c5803..a7d4b24b 100644
--- a/pcs/usage.py
+++ b/pcs/usage.py
@@ -1482,6 +1482,7 @@ Commands:
hash=sha256. To disable encryption, set cipher=none and hash=none.
Transports udp and udpu:
+ WARNING: These transports are not supported in RHEL 9.
These transports are limited to one address per node. They do not
support traffic encryption nor compression.
Transport options are:
--
2.43.0

View File

@ -1,23 +0,0 @@
From fa75f40361bc39cbd645b8014713e4c0ad0cda18 Mon Sep 17 00:00:00 2001
From: Ivan Devat <idevat@redhat.com>
Date: Mon, 24 Jan 2022 14:08:54 +0100
Subject: [PATCH 2/2] fix backend parameter "all" in cluster destroy
---
src/app/backend/calls/destroyCluster.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/app/backend/calls/destroyCluster.ts b/src/app/backend/calls/destroyCluster.ts
index b6e83a41..cf41ea42 100644
--- a/src/app/backend/calls/destroyCluster.ts
+++ b/src/app/backend/calls/destroyCluster.ts
@@ -4,5 +4,5 @@ const { url } = endpoints.destroyCluster;
export const destroyCluster = (clusterName: string): CallResult =>
http.post(url({ clusterName }), {
- params: [["--all", "1"]],
+ params: [["all", "1"]],
});
--
2.34.1

View File

@ -1,106 +0,0 @@
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

View File

@ -1,25 +0,0 @@
From 0b2dc6cc49715d8ae006b9f6877324e76ea9a271 Mon Sep 17 00:00:00 2001
From: rpm-build <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

View File

@ -1,33 +0,0 @@
From 272009b4e3582f9b7a045c3f4ee867f9e943ee9e Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Mon, 27 Nov 2023 09:34:46 +0800
Subject: [PATCH] fix serving static files
---
pcs/daemon/app/ui.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pcs/daemon/app/ui.py b/pcs/daemon/app/ui.py
index cad6824..11440a0 100644
--- a/pcs/daemon/app/ui.py
+++ b/pcs/daemon/app/ui.py
@@ -67,14 +67,14 @@ class Logout(app_session.Mixin, AjaxMixin, BaseHandler):
class StaticFileMayBe(StaticFile):
# pylint: disable=abstract-method
- def get(self, *args, **kwargs):
+ async def get(self, *args, **kwargs):
# pylint: disable=signature-differs
# pylint: disable=invalid-overridden-method
if not os.path.isdir(str(self.root)):
# spa is probably not installed
self.set_status(404, "Not Found")
return None
- return super().get(*args, **kwargs)
+ return await super().get(*args, **kwargs)
def get_routes(
--
2.33.0

View File

@ -1,484 +0,0 @@
From f240edb5dc9637d7fbd0a134fb45610fba6a3950 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Wed, 25 Oct 2023 14:18:19 +0800
Subject: [PATCH] improve error messages in pcs resource move
---
CHANGELOG.md | 3 +
pcs/cli/reports/messages.py | 13 ++
pcs/common/reports/messages.py | 17 ++-
pcs/lib/commands/resource.py | 116 ++++++++++++------
pcs/pcs.8.in | 2 +-
pcs/usage.py | 8 +-
pcs_test/tier0/cli/reports/test_messages.py | 49 ++++++++
.../tier0/common/reports/test_messages.py | 34 ++++-
.../resource/test_resource_move_autoclean.py | 8 ++
9 files changed, 206 insertions(+), 44 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c6007ac..9a32655 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,11 +19,14 @@
`pcs config checkpoint diff` command ([rhbz#2175881])
- Pcs daemon was allowing expired accounts, and accounts with expired
passwords to login when using PAM auth. ([huntr#220307])
+- Improved error messages and documentation of `pcs resource move` command
+ ([rhbz#2219554])
[ghissue#441]: https://github.com/ClusterLabs/pcs/issues/441
[ghpull#431]: https://github.com/ClusterLabs/pcs/pull/431
[rhbz#1996062]: https://bugzilla.redhat.com/show_bug.cgi?id=1996062
[rhbz#2019836]: https://bugzilla.redhat.com/show_bug.cgi?id=2019836
+[rhbz#2219554]: https://bugzilla.redhat.com/show_bug.cgi?id=2219554
[rhbz#2022463]: https://bugzilla.redhat.com/show_bug.cgi?id=2022463
[rhbz#2028902]: https://bugzilla.redhat.com/show_bug.cgi?id=2028902
[rhbz#2033248]: https://bugzilla.redhat.com/show_bug.cgi?id=2033248
diff --git a/pcs/cli/reports/messages.py b/pcs/cli/reports/messages.py
index 892ec15..5e1741b 100644
--- a/pcs/cli/reports/messages.py
+++ b/pcs/cli/reports/messages.py
@@ -516,6 +516,19 @@ class InvalidStonithAgentName(CliReportMessageCustom):
)
+class ResourceMoveAutocleanSimulationFailure(CliReportMessageCustom):
+ _obj: messages.ResourceMoveAutocleanSimulationFailure
+
+ @property
+ def message(self) -> str:
+ if not self._obj.move_constraint_left_in_cib:
+ return self._obj.message
+ node = format_optional(self._obj.node, " {}")
+ return (
+ f"{self._obj.message} Run 'pcs resource clear "
+ f"{self._obj.resource_id}{node}' to remove the constraint."
+ )
+
def _create_report_msg_map() -> Dict[str, type]:
result: Dict[str, type] = {}
for report_msg_cls in get_all_subclasses(CliReportMessageCustom):
diff --git a/pcs/common/reports/messages.py b/pcs/common/reports/messages.py
index 37c79ba..c183e96 100644
--- a/pcs/common/reports/messages.py
+++ b/pcs/common/reports/messages.py
@@ -6195,19 +6195,32 @@ class ResourceMoveAutocleanSimulationFailure(ReportItemMessage):
resource_id -- id of the resource to be moved
others_affected -- True if also other resource would be affected, False
otherwise
+ node -- target node the resource should be moved to
+ move_constraint_left_in_cib -- move has happened and the failure occurred
+ when trying to remove the move constraint from the live cib
"""
resource_id: str
others_affected: bool
+ node: Optional[str] = None
+ move_constraint_left_in_cib: bool = False
_code = codes.RESOURCE_MOVE_AUTOCLEAN_SIMULATION_FAILURE
@property
def message(self) -> str:
- return (
+ template = (
"Unable to ensure that moved resource '{resource_id}'{others} will "
"stay on the same node after a constraint used for moving it is "
"removed."
- ).format(
+ )
+ if self.move_constraint_left_in_cib:
+ template += (
+ " The constraint to move the resource has not been removed "
+ "from configuration. Consider removing it manually. Be aware "
+ "that removing the constraint may cause resources to move "
+ "to other nodes."
+ )
+ return template.format(
resource_id=self.resource_id,
others=" or other resources" if self.others_affected else "",
)
diff --git a/pcs/lib/commands/resource.py b/pcs/lib/commands/resource.py
index 82ce73e..39b24f0 100644
--- a/pcs/lib/commands/resource.py
+++ b/pcs/lib/commands/resource.py
@@ -1602,6 +1602,14 @@ def _nodes_exist_reports(
for node_name in (set(node_names) - existing_node_names)
]
+class ResourceMoveAutocleanSimulationFailure(Exception):
+ def __init__(self, other_resources_affected: bool):
+ super().__init__()
+ self._other_resources_affected = other_resources_affected
+
+ @property
+ def other_resources_affected(self) -> bool:
+ return self._other_resources_affected
def move_autoclean(
env: LibraryEnvironment,
@@ -1624,7 +1632,9 @@ def move_autoclean(
strict -- if True affecting other resources than the specified resource
will cause failure. If False affecting other resources is alowed.
"""
+ # pylint: disable=too-many-branches
# pylint: disable=too-many-locals
+ # pylint: disable=too-many-statements
wait_timeout = max(wait_timeout, 0)
if not env.is_cib_live:
raise LibraryError(
@@ -1655,6 +1665,8 @@ def move_autoclean(
reports.messages.CannotMoveResourceNotRunning(resource_id)
)
)
+ # add a move constraint to a temporary cib and get a cib diff which adds
+ # the move constraint
with get_tmp_cib(env.report_processor, cib_xml) as rsc_moved_cib_file:
stdout, stderr, retval = resource_move(
env.cmd_runner(dict(CIB_file=rsc_moved_cib_file.name)),
@@ -1676,6 +1688,8 @@ def move_autoclean(
add_constraint_cib_diff = diff_cibs_xml(
env.cmd_runner(), env.report_processor, cib_xml, rsc_moved_cib_xml
)
+ # clear the move constraint from the temporary cib and get a cib diff which
+ # removes the move constraint
with get_tmp_cib(
env.report_processor, rsc_moved_cib_xml
) as rsc_moved_constraint_cleared_cib_file:
@@ -1703,17 +1717,18 @@ def move_autoclean(
rsc_moved_cib_xml,
constraint_removed_cib,
)
-
+ # if both the diffs are no-op, nothing needs to be done
if not (add_constraint_cib_diff and remove_constraint_cib_diff):
env.report_processor.report(
reports.ReportItem.info(reports.messages.NoActionNecessary())
)
return
-
+ # simulate applying the diff which adds the move constraint
_, move_transitions, after_move_simulated_cib = simulate_cib(
env.cmd_runner(), get_cib(rsc_moved_cib_xml)
)
if strict:
+ # check if other resources would be affected
resources_affected_by_move = (
simulate_tools.get_resources_from_operations(
simulate_tools.get_operations_from_transitions(
@@ -1730,16 +1745,37 @@ def move_autoclean(
)
)
)
- _ensure_resource_moved_and_not_moved_back(
- env.cmd_runner,
- env.report_processor,
- etree_to_str(after_move_simulated_cib),
- remove_constraint_cib_diff,
- resource_id,
- strict,
- resource_state_before,
- node,
- )
+ # verify that:
+ # - a cib with added move constraint causes the resource to move by
+ # comparing the original status of the resource with a status computed
+ # from the cib with the added constraint
+ # - applying the diff which removes the move constraint won't trigger
+ # moving the resource (or other resources) around
+ try:
+ _ensure_resource_moved_and_not_moved_back(
+ env.cmd_runner,
+ env.report_processor,
+ etree_to_str(after_move_simulated_cib),
+ remove_constraint_cib_diff,
+ resource_id,
+ strict,
+ resource_state_before,
+ node,
+ )
+ except ResourceMoveAutocleanSimulationFailure as e:
+ raise LibraryError(
+ reports.ReportItem.error(
+ reports.messages.ResourceMoveAutocleanSimulationFailure(
+ resource_id,
+ e.other_resources_affected,
+ node=node,
+ move_constraint_left_in_cib=False,
+ )
+ )
+ ) from e
+
+ # apply the diff which adds the move constraint to the live cib and wait
+ # for the cluster to settle
push_cib_diff_xml(env.cmd_runner(), add_constraint_cib_diff)
env.report_processor.report(
ReportItem.info(
@@ -1747,16 +1783,36 @@ def move_autoclean(
)
)
env.wait_for_idle(wait_timeout)
- _ensure_resource_moved_and_not_moved_back(
- env.cmd_runner,
- env.report_processor,
- get_cib_xml(env.cmd_runner()),
- remove_constraint_cib_diff,
- resource_id,
- strict,
- resource_state_before,
- node,
- )
+ # verify that:
+ # - the live cib (now containing the move constraint) causes the resource
+ # to move by comparing the original status of the resource with a status
+ # computed from the live cib
+ # - applying the diff which removes the move constraint won't trigger
+ # moving the resource (or other resources) around
+ try:
+ _ensure_resource_moved_and_not_moved_back(
+ env.cmd_runner,
+ env.report_processor,
+ get_cib_xml(env.cmd_runner()),
+ remove_constraint_cib_diff,
+ resource_id,
+ strict,
+ resource_state_before,
+ node,
+ )
+ except ResourceMoveAutocleanSimulationFailure as e:
+ raise LibraryError(
+ reports.ReportItem.error(
+ reports.messages.ResourceMoveAutocleanSimulationFailure(
+ resource_id,
+ e.other_resources_affected,
+ node=node,
+ move_constraint_left_in_cib=True,
+ )
+ )
+ ) from e
+ # apply the diff which removes the move constraint to the live cib and wait
+ # for the cluster to settle
push_cib_diff_xml(env.cmd_runner(), remove_constraint_cib_diff)
env.report_processor.report(
ReportItem.info(
@@ -1822,13 +1878,7 @@ def _ensure_resource_moved_and_not_moved_back(
)
if strict:
if clean_operations:
- raise LibraryError(
- reports.ReportItem.error(
- reports.messages.ResourceMoveAutocleanSimulationFailure(
- resource_id, others_affected=True
- )
- )
- )
+ raise ResourceMoveAutocleanSimulationFailure(True)
else:
if any(
rsc == resource_id
@@ -1836,13 +1886,7 @@ def _ensure_resource_moved_and_not_moved_back(
clean_operations
)
):
- raise LibraryError(
- reports.ReportItem.error(
- reports.messages.ResourceMoveAutocleanSimulationFailure(
- resource_id, others_affected=False
- )
- )
- )
+ raise ResourceMoveAutocleanSimulationFailure(False)
def ban(env, resource_id, node=None, master=False, lifetime=None, wait=False):
diff --git a/pcs/pcs.8.in b/pcs/pcs.8.in
index 94514c1..8f4b647 100644
--- a/pcs/pcs.8.in
+++ b/pcs/pcs.8.in
@@ -152,7 +152,7 @@ debug\-monitor <resource id> [\fB\-\-full\fR]
This command will force the specified resource to be monitored on this node ignoring the cluster recommendations and print the output from monitoring the resource. Using \fB\-\-full\fR will give more detailed output. This is mainly used for debugging resources that fail to be monitored.
.TP
move <resource id> [destination node] [\fB\-\-promoted\fR] [\fB\-\-strict\fR] [\fB\-\-wait\fR[=n]]
-Move the resource off the node it is currently running on. This is achieved by creating a \-INFINITY location constraint to ban the node. If destination node is specified the resource will be moved to that node by creating an INFINITY location constraint to prefer the destination node. The constraint needed for moving the resource will be automatically removed once the resource is running on it's new location. The command will fail in case it is not possible to verify that the resource will not be moved back after deleting the constraint.
+Move the resource off the node it is currently running on. This is achieved by creating a \-INFINITY location constraint to ban the node. If destination node is specified the resource will be moved to that node by creating an INFINITY location constraint to prefer the destination node. The constraint needed for moving the resource will be automatically removed once the resource is running on its new location. The command will fail in case it is not possible to verify that the resource will not be moved back after deleting the constraint. If this happens after the location constraint has been created, the constraint will be left in the configuration.
If \fB\-\-strict\fR is specified, the command will also fail if other resources would be affected.
diff --git a/pcs/usage.py b/pcs/usage.py
index bc88591..aab6a78 100644
--- a/pcs/usage.py
+++ b/pcs/usage.py
@@ -369,9 +369,11 @@ Commands:
If destination node is specified the resource will be moved to that
node by creating an INFINITY location constraint to prefer the
destination node. The constraint needed for moving the resource will be
- automatically removed once the resource is running on it's new
- location. The command will fail in case it is not possible to verify
- that the resource will not be moved back after deleting the constraint.
+ automatically removed once the resource is running on its new location.
+ The command will fail in case it is not possible to verify that the
+ resource will not be moved back after deleting the constraint. If this
+ happens after the location constraint has been created, the constraint
+ will be left in the configuration.
If --strict is specified, the command will also fail if other resources
would be affected.
diff --git a/pcs_test/tier0/cli/reports/test_messages.py b/pcs_test/tier0/cli/reports/test_messages.py
index 6671021..ac8625c 100644
--- a/pcs_test/tier0/cli/reports/test_messages.py
+++ b/pcs_test/tier0/cli/reports/test_messages.py
@@ -618,3 +618,52 @@ class StonithRestartlessUpdateUnableToPerform(CliReportMessageTestBase):
report_msg,
f"{report_msg.message}, please use command 'pcs stonith update' instead",
)
+
+class ResourceMoveAutocleanSimulationFailure(CliReportMessageTestBase):
+ def test_constraint_not_created(self):
+ self.assert_message(
+ messages.ResourceMoveAutocleanSimulationFailure(
+ "R1", others_affected=True
+ ),
+ (
+ "Unable to ensure that moved resource 'R1' or other resources "
+ "will stay on the same node after a constraint used for moving "
+ "it is removed."
+ ),
+ )
+
+ def test_without_node(self):
+ self.assert_message(
+ messages.ResourceMoveAutocleanSimulationFailure(
+ "R1", others_affected=True, move_constraint_left_in_cib=True
+ ),
+ (
+ "Unable to ensure that moved resource 'R1' or other resources "
+ "will stay on the same node after a constraint used for moving "
+ "it is removed."
+ " The constraint to move the resource has not been removed "
+ "from configuration. Consider removing it manually. Be aware "
+ "that removing the constraint may cause resources to move to "
+ "other nodes."
+ " Run 'pcs resource clear R1' to remove the constraint."
+ ),
+ )
+
+ def test_with_node(self):
+ self.assert_message(
+ messages.ResourceMoveAutocleanSimulationFailure(
+ "R1",
+ others_affected=False,
+ node="node1",
+ move_constraint_left_in_cib=True,
+ ),
+ (
+ "Unable to ensure that moved resource 'R1' will stay on the "
+ "same node after a constraint used for moving it is removed."
+ " The constraint to move the resource has not been removed "
+ "from configuration. Consider removing it manually. Be aware "
+ "that removing the constraint may cause resources to move to "
+ "other nodes."
+ " Run 'pcs resource clear R1 node1' to remove the constraint."
+ ),
+ )
\ No newline at end of file
diff --git a/pcs_test/tier0/common/reports/test_messages.py b/pcs_test/tier0/common/reports/test_messages.py
index a56ef38..7b1b799 100644
--- a/pcs_test/tier0/common/reports/test_messages.py
+++ b/pcs_test/tier0/common/reports/test_messages.py
@@ -4542,7 +4542,7 @@ class ResourceMoveAffectsOtherResources(NameBuildTest):
class ResourceMoveAutocleanSimulationFailure(NameBuildTest):
- def test_success(self):
+ def test_simulation(self):
self.assert_message_from_report(
(
"Unable to ensure that moved resource 'R1' will stay on the "
@@ -4553,7 +4553,7 @@ class ResourceMoveAutocleanSimulationFailure(NameBuildTest):
),
)
- def test_others_affected(self):
+ def test_simulation_others_affected(self):
self.assert_message_from_report(
(
"Unable to ensure that moved resource 'R1' or other resources "
@@ -4565,6 +4565,36 @@ class ResourceMoveAutocleanSimulationFailure(NameBuildTest):
),
)
+ def test_live(self):
+ self.assert_message_from_report(
+ (
+ "Unable to ensure that moved resource 'R1' will stay on the "
+ "same node after a constraint used for moving it is removed."
+ " The constraint to move the resource has not been removed "
+ "from configuration. Consider removing it manually. Be aware "
+ "that removing the constraint may cause resources to move to "
+ "other nodes."
+ ),
+ reports.ResourceMoveAutocleanSimulationFailure(
+ "R1", others_affected=False, move_constraint_left_in_cib=True
+ ),
+ )
+
+ def test_live_others_affected(self):
+ self.assert_message_from_report(
+ (
+ "Unable to ensure that moved resource 'R1' or other resources "
+ "will stay on the same node after a constraint used for moving "
+ "it is removed."
+ " The constraint to move the resource has not been removed "
+ "from configuration. Consider removing it manually. Be aware "
+ "that removing the constraint may cause resources to move to "
+ "other nodes."
+ ),
+ reports.ResourceMoveAutocleanSimulationFailure(
+ "R1", others_affected=True, move_constraint_left_in_cib=True
+ ),
+ )
class ParseErrorJsonFile(NameBuildTest):
def test_success(self):
diff --git a/pcs_test/tier0/lib/commands/resource/test_resource_move_autoclean.py b/pcs_test/tier0/lib/commands/resource/test_resource_move_autoclean.py
index 90ed2d8..6e5c286 100644
--- a/pcs_test/tier0/lib/commands/resource/test_resource_move_autoclean.py
+++ b/pcs_test/tier0/lib/commands/resource/test_resource_move_autoclean.py
@@ -1261,6 +1261,8 @@ class MoveAutocleanFailures(MoveAutocleanCommonSetup):
reports.codes.RESOURCE_MOVE_AUTOCLEAN_SIMULATION_FAILURE,
resource_id=self.resource_id,
others_affected=False,
+ node=None,
+ move_constraint_left_in_cib=False,
)
],
expected_in_processor=False,
@@ -1292,6 +1294,8 @@ class MoveAutocleanFailures(MoveAutocleanCommonSetup):
reports.codes.RESOURCE_MOVE_AUTOCLEAN_SIMULATION_FAILURE,
resource_id=self.resource_id,
others_affected=True,
+ node=None,
+ move_constraint_left_in_cib=False,
)
],
expected_in_processor=False,
@@ -1324,6 +1328,8 @@ class MoveAutocleanFailures(MoveAutocleanCommonSetup):
reports.codes.RESOURCE_MOVE_AUTOCLEAN_SIMULATION_FAILURE,
resource_id=self.resource_id,
others_affected=False,
+ node=None,
+ move_constraint_left_in_cib=True,
)
],
expected_in_processor=False,
@@ -1355,6 +1361,8 @@ class MoveAutocleanFailures(MoveAutocleanCommonSetup):
reports.codes.RESOURCE_MOVE_AUTOCLEAN_SIMULATION_FAILURE,
resource_id=self.resource_id,
others_affected=True,
+ node=None,
+ move_constraint_left_in_cib=True,
)
],
expected_in_processor=False,
--
2.33.0

Binary file not shown.

BIN
pcs-0.11.7.tar.gz Normal file

Binary file not shown.

Binary file not shown.

BIN
pcs-web-ui-0.1.18.tar.gz Normal file

Binary file not shown.

135
pcs.spec
View File

@ -1,24 +1,23 @@
Name: pcs
Version: 0.11.2
Release: 10
License: GPLv2 and BSD-2-Clause and ASL 2.0 and MIT
Version: 0.11.7
Release: 1
License: GPL-2.0-only AND Apache-2.0 AND MIT AND BSD-3-Clause AND (BSD-2-Clause OR Ruby) AND (BSD-2-Clause OR GPL-2.0-or-later)
URL: https://github.com/ClusterLabs/pcs
Group: System Environment/Base
Summary: Pacemaker Configuration System
%global version_or_commit %{version}
%global pcs_source_name %{name}-%{version_or_commit}
# ui_commit can be determined by hash, tag or branch
%global ui_commit 0.1.12
%global ui_modules_version 0.1.12
%global ui_commit 0.1.18
%global ui_modules_version 0.1.18
%global ui_src_name pcs-web-ui-%{ui_commit}
%global pcs_snmp_pkg_name pcs-snmp
%global pyagentx_version 0.4.pcs.2
%global dacite_version 1.6.0
%global version_rubygem_thin 1.8.1
%global dacite_version 1.8.1
%global required_pacemaker_version 2.1.0
@ -29,31 +28,24 @@ Summary: Pacemaker Configuration System
#part after last slash is recognized as filename in look-aside repository
#desired name is achived by trick with hash anchor
Source0: %{url}/archive/%{version_or_commit}/%{pcs_source_name}.tar.gz
Source0: %{url}/archive/%{?v_prefix}%{version_or_commit}/%{pcs_source_name}.tar.gz
Source1: https://github.com/ondrejmular/pyagentx/archive/v%{pyagentx_version}/pyagentx-%{pyagentx_version}.tar.gz
Source2: https://github.com/konradhalas/dacite/archive/v%{dacite_version}/dacite-%{dacite_version}.tar.gz
Source3: https://rubygems.org/downloads/thin-%{version_rubygem_thin}.gem
Source4: https://github.com/ClusterLabs/pcs-web-ui/archive/%{ui_commit}/%{ui_src_name}.tar.gz
Source5: https://github.com/ClusterLabs/pcs-web-ui/releases/download/%{ui_commit}/pcs-web-ui-node-modules-%{ui_modules_version}.tar.xz
Source3: https://github.com/ClusterLabs/pcs-web-ui/archive/%{ui_commit}/%{ui_src_name}.tar.gz
Source4: https://github.com/ClusterLabs/pcs-web-ui/releases/download/%{ui_commit}/pcs-web-ui-node-modules-%{ui_modules_version}.tar.xz
# pcs patches: <= 200
# Patch0: bzNUMBER-01-name.patch
Patch0: do-not-support-cluster-setup-with-udp-u-transport.patch
Patch1: Support-for-openEuler.patch
# ui patches: >200
# Patch201: bzNUMBER-01-name.patch
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
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
Patch8: tests-fix-datetime-race-condition.patch
Patch9: Fix-CVE-2022-1049.patch
Patch10: Fix-CVE-2022-2735.patch
Patch11: improve-error-messages-in-pcs-resource-move.patch
Patch12: fix-serving-static-files.patch
# git for patches
BuildRequires: git-core
BuildRequires: make
#printf from coreutils is used in makefile
# printf from coreutils is used in makefile, head is used in spec
BuildRequires: coreutils
# python for pcs
BuildRequires: python3 >= 3.9
@ -69,38 +61,42 @@ BuildRequires: python3-lxml
# for building bundled python packages
BuildRequires: python3-wheel
# for bundled python dateutil
# dateutil was unbundled in Fedora but our autotools still check for it
BuildRequires: python3-setuptools_scm
BuildRequires: python3-distro
# gcc for compiling custom rubygems
BuildRequires: gcc
BuildRequires: gcc-c++
# ruby and gems for pcsd
BuildRequires: ruby >= 2.5.0
BuildRequires: ruby-devel
BuildRequires: rubygems
BuildRequires: rubygem-bundler
BuildRequires: rubygem-backports
BuildRequires: rubygem-daemons
BuildRequires: rubygem-childprocess
BuildRequires: rubygem-ethon
BuildRequires: rubygem-eventmachine
BuildRequires: rubygem-ffi
BuildRequires: rubygem-io-console
BuildRequires: rubygem-json
BuildRequires: rubygem-mustermann
BuildRequires: rubygem-open4
BuildRequires: rubygem-puma
BuildRequires: rubygem-rack
BuildRequires: rubygem-rack-protection
BuildRequires: rubygem-rack-test
BuildRequires: rubygem-sinatra
BuildRequires: rubygem-tilt
BuildRequires: rubygem(rexml)
BuildRequires: rubygem(webrick)
# ruby libraries for tests
BuildRequires: rubygem-test-unit
# for bundled rubygems
BuildRequires: rubygems
BuildRequires: rubygem-bundler
BuildRequires: gcc
BuildRequires: gcc-c++
# for touching patch files (sanitization function)
BuildRequires: diffstat
# for post, preun and postun macros
BuildRequires: systemd
# pam is used for authentication inside daemon (python ctypes)
# needed for tier0 tests during build
BuildRequires: pam
BuildRequires: make
# for working with qdevice certificates (certutil) - used in configure.ac
BuildRequires: nss-tools
# for building web ui
BuildRequires: npm
@ -126,21 +122,18 @@ Requires: python3-tornado
# ruby and gems for pcsd
Requires: ruby >= 2.5.0
Requires: rubygem-backports
Requires: rubygem-daemons
Requires: rubygem-childprocess
Requires: rubygem-ethon
Requires: rubygem-eventmachine
Requires: rubygem-ffi
Requires: rubygem-json
Requires: rubygem-mustermann
Requires: rubygem-open4
Requires: rubygem-puma
Requires: rubygem-rack
Requires: rubygem-rack-protection
Requires: rubygem-rack-test
Requires: rubygem-sinatra
Requires: rubygem-tilt
Requires: rubygem(rexml)
Requires: rubygem(webrick)
# ruby and gems for pcsd-ruby
# for killall
Requires: psmisc
# cluster stack and related packages
@ -159,10 +152,10 @@ Requires(postun): systemd
Requires: pam
# needs logrotate for /etc/logrotate.d/pcsd
Requires: logrotate
# for working with qdevice certificates (certutil)
Requires: nss-tools
Provides: bundled(dacite) = %{dacite_version}
# bundled rubygems
Provides: bundled(thin) = %{version_rubygem_thin}
%description
pcs is a corosync and pacemaker configuration tool. It permits users to
@ -171,9 +164,9 @@ easily view, modify and create pacemaker based clusters.
# pcs-snmp package definition
%package -n %{pcs_snmp_pkg_name}
Summary: Pacemaker cluster SNMP agent
License: GPLv2 and BSD-2-Clause
License: GPL-2.0-only and BSD-2-Clause
# tar for unpacking pyagetx source tar ball
# tar for unpacking pyagetx source tarball
BuildRequires: tar
Requires: pcs = %{version}-%{release}
@ -230,25 +223,23 @@ update_times_patch(){
# * http://ftp.rpm.org/max-rpm/s1-rpm-inside-macros.html
# * https://rpm-software-management.github.io/rpm/manual/autosetup.html
# patch web-ui sources
%autosetup -D -T -b 4 -a 5 -S git -n %{ui_src_name} -N
%autopatch -p1 -M 1
# update_times_patch %%{PATCH1}
update_times_patch %{PATCH0}
update_times_patch %{PATCH1}
%autosetup -D -T -b 3 -a 4 -S git -n %{ui_src_name} -N
%autopatch -p1 -m 201
# update_times_patch %%{PATCH201}
# patch pcs sources
%autosetup -S git -n %{pcs_source_name} -N
%autopatch -p1 -m 2
update_times_patch %{PATCH2}
%autopatch -p1 -m 0
# update_times_patch %%{PATCH0}
update_times_patch %{PATCH0}
# prepare dirs/files necessary for building all bundles
# -----------------------------------------------------
# 1) rubygems sources
# generate .tarball-version if building from an untagged commit, not a released version
# autogen uses git-version-gen which uses .tarball-version for generating version number
%if "%{version}" != "%{version_or_commit}"
echo "%version+$(echo "%{version_or_commit}" | head -c 8)" > %{_builddir}/%{pcs_source_name}/.tarball-version
%endif
mkdir -p %{rubygem_cache_dir}
cp -f %SOURCE3 %{rubygem_cache_dir}
# 2) prepare python bundles
# prepare dirs/files necessary for building python bundles
mkdir -p %{pcs_bundled_dir}/src
cp -f %SOURCE1 rpm/
cp -f %SOURCE2 rpm/
@ -261,7 +252,7 @@ cp -f %SOURCE2 rpm/
make all
# build pcs-web-ui
make -C %{_builddir}/%{ui_src_name} build BUILD_USE_EXISTING_NODE_MODULES=true
BUILD_USE_CURRENT_NODE_MODULES=true make -C %{_builddir}/%{ui_src_name} build
%install
rm -rf $RPM_BUILD_ROOT
@ -273,11 +264,10 @@ pwd
cp -r %{_builddir}/%{ui_src_name}/build ${RPM_BUILD_ROOT}%{_libdir}/%{pcsd_public_dir}/ui
# symlink favicon into pcsd directories
mkdir -p ${RPM_BUILD_ROOT}%{_libdir}/%{pcsd_public_dir}/images/
ln -fs /etc/favicon.png ${RPM_BUILD_ROOT}%{_libdir}/%{pcsd_public_dir}/images/favicon.png
mkdir -p ${RPM_BUILD_ROOT}%{_libdir}/%{pcsd_public_dir}/ui/static/media
ln -fs /etc/favicon.png ${RPM_BUILD_ROOT}%{_libdir}/%{pcsd_public_dir}/ui/static/media/favicon.png
# prepare license files
# some rubygems do not have a license file (thin)
cp %{pcs_bundled_dir}/src/pyagentx-*/LICENSE.txt pyagentx_LICENSE.txt
cp %{pcs_bundled_dir}/src/pyagentx-*/CONTRIBUTORS.txt pyagentx_CONTRIBUTORS.txt
cp %{pcs_bundled_dir}/src/pyagentx-*/README.md pyagentx_README.md
@ -288,18 +278,15 @@ cp %{pcs_bundled_dir}/src/dacite-*/README.md dacite_README.md
# We are not building debug package for pcs but we need to add MiniDebuginfo
# to the bundled shared libraries from rubygem extensions in order to satisfy
# rpmdiff's binary stripping checker.
# Therefore we call find-debuginfo.sh script manually in order to strip
# Therefore we call find-debuginfo from debugedit manually in order to strip
# binaries and add MiniDebugInfo with .gnu_debugdata section
/usr/lib/rpm/find-debuginfo.sh -j2 -m -i -S debugsourcefiles.list
# find-debuginfo.sh generated some files into /usr/lib/debug and
find-debuginfo -j2 -m -i -S debugsourcefiles.list
# find-debuginfo generated some files into /usr/lib/debug and
# /usr/src/debug/ that we don't want in the package
rm -rf $RPM_BUILD_ROOT%{_libdir}/debug
rm -rf $RPM_BUILD_ROOT/usr/lib/debug
rm -rf $RPM_BUILD_ROOT%{_prefix}/src/debug
# We can remove files required for gem compilation
rm -rf $RPM_BUILD_ROOT%{_libdir}/%{rubygem_bundle_dir}/gems/thin-%{version_rubygem_thin}/ext
%check
# In the building environment LC_CTYPE is set to C which causes tests to fail
# due to python prints a warning about it to stderr. The following environment
@ -338,13 +325,12 @@ run_all_tests(){
run_all_tests
%posttrans
# Make sure the new version of the daemon is runnning.
# Make sure the new version of the daemon is running.
# Also, make sure to start pcsd-ruby if it hasn't been started or even
# installed before. This is done by restarting pcsd.service.
%{_bindir}/systemctl daemon-reload
%{_bindir}/systemctl try-restart pcsd.service
%post
%systemd_post pcsd.service
%systemd_post pcsd-ruby.service
@ -412,6 +398,9 @@ run_all_tests
%license pyagentx_LICENSE.txt
%changelog
* Tue Feb 27 2024 zouzhimin <zouzhimin@kylinos.cn> - 0.11.7-1
- Update package to version 0.11.7
* Thu Nov 23 2023 bixiaoyan <bixiaoyan@kylinos.cn> - 0.11.2-10
- Fix serving static files

View File

@ -1,26 +0,0 @@
From f44cdc871a39da3960bd04565b4d1d5ffa19bd23 Mon Sep 17 00:00:00 2001
From: Ivan Devat <idevat@redhat.com>
Date: Thu, 20 Jan 2022 13:32:49 +0100
Subject: [PATCH 1/2] simplify ternar expression
The motivation for this is that covscan complains about it.
---
src/app/view/share/useUrlTabs.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/app/view/share/useUrlTabs.ts b/src/app/view/share/useUrlTabs.ts
index 7278dad8..a1136bf3 100644
--- a/src/app/view/share/useUrlTabs.ts
+++ b/src/app/view/share/useUrlTabs.ts
@@ -13,7 +13,7 @@ export const useUrlTabs = <TABS extends ReadonlyArray<string>>(
return {
currentTab,
- matchedContext: tab !== null ? tab.matched : `/${defaultTab}`,
+ matchedContext: tab?.matched ?? `/${defaultTab}`,
tabList,
};
};
--
2.34.1

View File

@ -1,27 +0,0 @@
From b8e186f82cafea79e0ebf9beb1627ce0c62a8b16 Mon Sep 17 00:00:00 2001
From: bizhiyuan <bizhiyuan@kylinos.cn>
Date: Wed, 6 Sep 2023 01:02:45 +0800
Subject: [PATCH] tests: fix datetime race condition
---
pcs_test/tier1/legacy/test_constraints.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/pcs_test/tier1/legacy/test_constraints.py b/pcs_test/tier1/legacy/test_constraints.py
index 963fbe8..90c8d7f 100644
--- a/pcs_test/tier1/legacy/test_constraints.py
+++ b/pcs_test/tier1/legacy/test_constraints.py
@@ -4709,7 +4709,9 @@ class LocationAdd(ConstraintEffect):
@skip_unless_crm_rule()
class ExpiredConstraints(ConstraintBaseTest):
- _tomorrow = (datetime.date.today() + datetime.timedelta(days=1)).strftime(
+ # Setting tomorrow to the day after tomorrow in case the tests run close to
+ # midnight.
+ _tomorrow = (datetime.date.today() + datetime.timedelta(days=2)).strftime(
"%Y-%m-%d"
)
--
2.27.0

Binary file not shown.