Resolves: rhbz#2148124 rhbz#2151164 rhbz#2151524
- Fixed stopping of pcsd service using `systemctl stop pcsd` command - Fixed smoke test execution during gating - Added warning when omitting validation of misconfigured resource - Fixed displaying of bool and integer values in `pcs resource config` command - Updated bundled rubygems: ethon, rack-protection, sinatra
This commit is contained in:
parent
225917d4f4
commit
9792d48c7b
3
.gitignore
vendored
3
.gitignore
vendored
@ -182,3 +182,6 @@
|
||||
/pcs-0.11.4.tar.gz
|
||||
/pcs-web-ui-0.1.16.tar.gz
|
||||
/pcs-web-ui-node-modules-0.1.16.tar.xz
|
||||
/ethon-0.16.0.gem
|
||||
/rack-protection-3.0.4.gem
|
||||
/sinatra-3.0.4.gem
|
||||
|
215
01-smoke-test-fix.patch
Normal file
215
01-smoke-test-fix.patch
Normal file
@ -0,0 +1,215 @@
|
||||
From 2f1b9d7f225530dfc88af57d364547d9ad425172 Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Mular <omular@redhat.com>
|
||||
Date: Thu, 24 Nov 2022 15:10:20 +0100
|
||||
Subject: [PATCH] smoke test improvements
|
||||
|
||||
---
|
||||
.gitignore | 1 +
|
||||
.gitlab-ci.yml | 1 +
|
||||
configure.ac | 2 +-
|
||||
pcs/Makefile.am | 1 -
|
||||
pcs/api_v2_client.in | 22 --------------------
|
||||
pcs_test/Makefile.am | 1 +
|
||||
pcs_test/api_v2_client.in | 20 +++++++++++++++++++
|
||||
{pcs => pcs_test}/api_v2_client.py | 0
|
||||
pcs_test/smoke.sh.in | 32 +++++++++++++++++++-----------
|
||||
9 files changed, 44 insertions(+), 36 deletions(-)
|
||||
delete mode 100644 pcs/api_v2_client.in
|
||||
create mode 100644 pcs_test/api_v2_client.in
|
||||
rename {pcs => pcs_test}/api_v2_client.py (100%)
|
||||
|
||||
diff --git a/.gitignore b/.gitignore
|
||||
index b368a048..8dd3d5be 100644
|
||||
--- a/.gitignore
|
||||
+++ b/.gitignore
|
||||
@@ -21,6 +21,7 @@ requirements.txt
|
||||
setup.py
|
||||
setup.cfg
|
||||
pcs/api_v2_client
|
||||
+pcs_test/api_v2_client
|
||||
pcs/pcs
|
||||
pcs/pcs_internal
|
||||
pcs/settings.py
|
||||
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
|
||||
index d4e0074d..3d797729 100644
|
||||
--- a/.gitlab-ci.yml
|
||||
+++ b/.gitlab-ci.yml
|
||||
@@ -126,6 +126,7 @@ python_smoke_tests:
|
||||
- ./autogen.sh
|
||||
- ./configure --enable-local-build
|
||||
- make
|
||||
+ - rm -rf pcs
|
||||
- pcs_test/smoke.sh
|
||||
artifacts:
|
||||
paths:
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index bc8abb39..b61c1b25 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -578,10 +578,10 @@ AC_CONFIG_FILES([Makefile
|
||||
pcsd/settings.rb
|
||||
pcsd/logrotate/pcsd])
|
||||
|
||||
-AC_CONFIG_FILES([pcs/api_v2_client], [chmod +x pcs/api_v2_client])
|
||||
AC_CONFIG_FILES([pcs/pcs], [chmod +x pcs/pcs])
|
||||
AC_CONFIG_FILES([pcs/pcs_internal], [chmod +x pcs/pcs_internal])
|
||||
AC_CONFIG_FILES([pcs/snmp/pcs_snmp_agent], [chmod +x pcs/snmp/pcs_snmp_agent])
|
||||
+AC_CONFIG_FILES([pcs_test/api_v2_client], [chmod +x pcs_test/api_v2_client])
|
||||
AC_CONFIG_FILES([pcs_test/smoke.sh], [chmod +x pcs_test/smoke.sh])
|
||||
AC_CONFIG_FILES([pcs_test/pcs_for_tests], [chmod +x pcs_test/pcs_for_tests])
|
||||
AC_CONFIG_FILES([pcs_test/suite], [chmod +x pcs_test/suite])
|
||||
diff --git a/pcs/Makefile.am b/pcs/Makefile.am
|
||||
index 5c5104b4..f562b32c 100644
|
||||
--- a/pcs/Makefile.am
|
||||
+++ b/pcs/Makefile.am
|
||||
@@ -20,7 +20,6 @@ EXTRA_DIST = \
|
||||
acl.py \
|
||||
alert.py \
|
||||
app.py \
|
||||
- api_v2_client.py \
|
||||
cli/booth/command.py \
|
||||
cli/booth/env.py \
|
||||
cli/booth/__init__.py \
|
||||
diff --git a/pcs/api_v2_client.in b/pcs/api_v2_client.in
|
||||
deleted file mode 100644
|
||||
index 93336c31..00000000
|
||||
--- a/pcs/api_v2_client.in
|
||||
+++ /dev/null
|
||||
@@ -1,22 +0,0 @@
|
||||
-#!@PYTHON@
|
||||
-
|
||||
-import os.path
|
||||
-import sys
|
||||
-
|
||||
-CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
-
|
||||
-# We prevent to import some module from this dir instead of e.g. standard module.
|
||||
-# There is no reason to import anything from this module.
|
||||
-sys.path.remove(CURRENT_DIR)
|
||||
-
|
||||
-# Add pcs package.
|
||||
-PACKAGE_DIR = os.path.dirname(CURRENT_DIR)
|
||||
-BUNDLED_PACKAGES_DIR = os.path.join(
|
||||
- PACKAGE_DIR, "@PCS_BUNDLED_DIR_LOCAL@", "packages"
|
||||
-)
|
||||
-sys.path.insert(0, BUNDLED_PACKAGES_DIR)
|
||||
-sys.path.insert(0, PACKAGE_DIR)
|
||||
-
|
||||
-from pcs import api_v2_client
|
||||
-
|
||||
-api_v2_client.main()
|
||||
diff --git a/pcs_test/Makefile.am b/pcs_test/Makefile.am
|
||||
index 89a23e05..6f497a0e 100644
|
||||
--- a/pcs_test/Makefile.am
|
||||
+++ b/pcs_test/Makefile.am
|
||||
@@ -57,6 +57,7 @@ EXTRA_DIST = \
|
||||
resources/transitions01.xml \
|
||||
resources/transitions02.xml \
|
||||
suite.py \
|
||||
+ api_v2_client.py \
|
||||
tier0/cli/booth/__init__.py \
|
||||
tier0/cli/booth/test_env.py \
|
||||
tier0/cli/cluster/__init__.py \
|
||||
diff --git a/pcs_test/api_v2_client.in b/pcs_test/api_v2_client.in
|
||||
new file mode 100644
|
||||
index 00000000..73a22324
|
||||
--- /dev/null
|
||||
+++ b/pcs_test/api_v2_client.in
|
||||
@@ -0,0 +1,20 @@
|
||||
+#!@PYTHON@
|
||||
+import os.path
|
||||
+import sys
|
||||
+
|
||||
+CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
+
|
||||
+TEST_INSTALLED = os.environ.get("PCS_TEST.TEST_INSTALLED", "0") == "1"
|
||||
+
|
||||
+if TEST_INSTALLED:
|
||||
+ BUNDLED_PACKAGES_DIR = os.path.join("@PCS_BUNDLED_DIR@", "packages")
|
||||
+else:
|
||||
+ PACKAGE_DIR = os.path.dirname(CURRENT_DIR)
|
||||
+ sys.path.insert(0, PACKAGE_DIR)
|
||||
+ BUNDLED_PACKAGES_DIR = os.path.join(PACKAGE_DIR, "@PCS_BUNDLED_DIR_LOCAL@", "packages")
|
||||
+
|
||||
+sys.path.insert(0, BUNDLED_PACKAGES_DIR)
|
||||
+
|
||||
+from api_v2_client import main
|
||||
+
|
||||
+main()
|
||||
diff --git a/pcs/api_v2_client.py b/pcs_test/api_v2_client.py
|
||||
similarity index 100%
|
||||
rename from pcs/api_v2_client.py
|
||||
rename to pcs_test/api_v2_client.py
|
||||
diff --git a/pcs_test/smoke.sh.in b/pcs_test/smoke.sh.in
|
||||
index 42321777..b845b6d6 100755
|
||||
--- a/pcs_test/smoke.sh.in
|
||||
+++ b/pcs_test/smoke.sh.in
|
||||
@@ -1,6 +1,8 @@
|
||||
#!@BASH@
|
||||
set -ex
|
||||
|
||||
+SCRIPT_DIR="$(dirname -- "$(realpath -- "$0")")"
|
||||
+
|
||||
cluster_user=hacluster
|
||||
cluster_user_password=qa57Jk27eP
|
||||
pcsd_socket_path="@LOCALSTATEDIR@/run/pcsd.socket"
|
||||
@@ -15,13 +17,15 @@ if pidof systemd | grep "\b1\b"; then
|
||||
pcs cluster setup cluster-name localhost --debug
|
||||
fi
|
||||
|
||||
+output_file=$(mktemp)
|
||||
+token_file=$(mktemp)
|
||||
+
|
||||
# Sanity check of API V0
|
||||
token=$(python3 -c "import json; print(json.load(open('@LOCALSTATEDIR@/lib/pcsd/known-hosts'))['known_hosts']['localhost']['token']);")
|
||||
-curl -kb "token=${token}" https://localhost:2224/remote/cluster_status_plaintext -d 'data_json={}' > output.json
|
||||
-cat output.json; echo ""
|
||||
-python3 -c "import json; import sys; json.load(open('output.json'))['status'] == 'exception' and (sys.exit(1))";
|
||||
+curl -kb "token=${token}" https://localhost:2224/remote/cluster_status_plaintext -d 'data_json={}' > "${output_file}"
|
||||
+cat "${output_file}"; echo ""
|
||||
+python3 -c "import json; import sys; json.load(open('${output_file}'))['status'] == 'exception' and (sys.exit(1))";
|
||||
|
||||
-token_file=$(mktemp)
|
||||
dd if=/dev/urandom bs=32 count=1 status=none | base64 > "${token_file}"
|
||||
custom_localhost_node_name="custom-node-name"
|
||||
|
||||
@@ -30,24 +34,28 @@ pcs pcsd accept_token "${token_file}"
|
||||
pcs pcsd status "${custom_localhost_node_name}" | grep "${custom_localhost_node_name}: Online"
|
||||
|
||||
# Sanity check of API V1
|
||||
-curl -kb "token=${token}" https://localhost:2224/api/v1/resource-agent-get-agents-list/v1 --data '{}' > output.json
|
||||
-cat output.json; echo ""
|
||||
-python3 -c "import json; import sys; json.load(open('output.json'))['status'] != 'success' and (sys.exit(1))";
|
||||
+curl -kb "token=${token}" https://localhost:2224/api/v1/resource-agent-get-agents-list/v1 --data '{}' > "${output_file}"
|
||||
+cat "${output_file}"; echo ""
|
||||
+python3 -c "import json; import sys; json.load(open('${output_file}'))['status'] != 'success' and (sys.exit(1))";
|
||||
|
||||
# Sanity check of API V2
|
||||
# async
|
||||
-pcs/api_v2_client resource_agent.get_agent_metadata '{"agent_name":{"standard":"ocf","provider":"pacemaker","type":"Dummy"}}'
|
||||
+env "PCS_TEST.TEST_INSTALLED=1" ${SCRIPT_DIR}/api_v2_client resource_agent.get_agent_metadata '{"agent_name":{"standard":"ocf","provider":"pacemaker","type":"Dummy"}}'
|
||||
|
||||
# sync
|
||||
-pcs/api_v2_client --sync resource_agent.get_agent_metadata '{"agent_name":{"standard":"ocf","provider":"pacemaker","type":"Stateful"}}'
|
||||
+env "PCS_TEST.TEST_INSTALLED=1" ${SCRIPT_DIR}/api_v2_client --sync resource_agent.get_agent_metadata '{"agent_name":{"standard":"ocf","provider":"pacemaker","type":"Stateful"}}'
|
||||
|
||||
# unix socket test
|
||||
-curl --unix-socket "${pcsd_socket_path}" http:/something/api/v1/resource-agent-get-agents-list/v1 --data '{}' > output.json
|
||||
-cat output.json; echo ""
|
||||
-python3 -c "import json; import sys; json.load(open('output.json'))['status'] != 'success' and (sys.exit(1))";
|
||||
+curl --unix-socket "${pcsd_socket_path}" http:/something/api/v1/resource-agent-get-agents-list/v1 --data '{}' > "${output_file}"
|
||||
+cat "${output_file}"; echo ""
|
||||
+python3 -c "import json; import sys; json.load(open('${output_file}'))['status'] != 'success' and (sys.exit(1))";
|
||||
|
||||
# make sure socket is not accessible by all users
|
||||
useradd testuser
|
||||
su testuser
|
||||
! curl --unix-socket "${pcsd_socket_path}" http:/something/api/v1/resource-agent-get-agents-list/v1 --data '{}'
|
||||
+
|
||||
+# cleanup
|
||||
+rm "${token_file}"
|
||||
+rm "${output_file}"
|
||||
exit 0
|
||||
--
|
||||
2.38.1
|
||||
|
30
02-smoke-test-fix.patch
Normal file
30
02-smoke-test-fix.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From 4692f1032b7954d56f76f243283d519e8453ff58 Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Lisik <mlisik@redhat.com>
|
||||
Date: Tue, 29 Nov 2022 17:46:08 +0100
|
||||
Subject: [PATCH 1/3] fix smoke test
|
||||
|
||||
---
|
||||
pcs_test/smoke.sh.in | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/pcs_test/smoke.sh.in b/pcs_test/smoke.sh.in
|
||||
index b845b6d6..e9466efd 100755
|
||||
--- a/pcs_test/smoke.sh.in
|
||||
+++ b/pcs_test/smoke.sh.in
|
||||
@@ -52,10 +52,11 @@ python3 -c "import json; import sys; json.load(open('${output_file}'))['status']
|
||||
|
||||
# make sure socket is not accessible by all users
|
||||
useradd testuser
|
||||
-su testuser
|
||||
-! curl --unix-socket "${pcsd_socket_path}" http:/something/api/v1/resource-agent-get-agents-list/v1 --data '{}'
|
||||
+su testuser -c '! curl --unix-socket '"${pcsd_socket_path}"' http:/something/api/v1/resource-agent-get-agents-list/v1 --data '\''{}'\'''
|
||||
|
||||
# cleanup
|
||||
rm "${token_file}"
|
||||
rm "${output_file}"
|
||||
+pcs cluster destroy --force
|
||||
+userdel -r testuser
|
||||
exit 0
|
||||
--
|
||||
2.38.1
|
||||
|
40
bz2148124-01-pcsd-systemd-killmode.patch
Normal file
40
bz2148124-01-pcsd-systemd-killmode.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From d486d9c9bafbfc13be7ff86c0ae781feed184d52 Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Mular <omular@redhat.com>
|
||||
Date: Thu, 24 Nov 2022 08:15:13 +0100
|
||||
Subject: [PATCH 1/2] fix graceful termination of pcsd via systemd
|
||||
|
||||
---
|
||||
CHANGELOG.md | 5 +++++
|
||||
pcsd/pcsd.service.in | 1 +
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/CHANGELOG.md b/CHANGELOG.md
|
||||
index 7d3d606b..7927eae6 100644
|
||||
--- a/CHANGELOG.md
|
||||
+++ b/CHANGELOG.md
|
||||
@@ -1,5 +1,10 @@
|
||||
# Change Log
|
||||
|
||||
+## [Unreleased]
|
||||
+
|
||||
+### Fixed
|
||||
+- Graceful stopping pcsd service using `systemctl stop pcsd` command
|
||||
+
|
||||
## [0.11.4] - 2022-11-21
|
||||
|
||||
### Security
|
||||
diff --git a/pcsd/pcsd.service.in b/pcsd/pcsd.service.in
|
||||
index 8591e750..dca5052d 100644
|
||||
--- a/pcsd/pcsd.service.in
|
||||
+++ b/pcsd/pcsd.service.in
|
||||
@@ -11,6 +11,7 @@ After=pcsd-ruby.service
|
||||
EnvironmentFile=@CONF_DIR@/pcsd
|
||||
ExecStart=@SBINDIR@/pcsd
|
||||
Type=notify
|
||||
+KillMode=mixed
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
--
|
||||
2.38.1
|
||||
|
145
bz2151164-01-fix-displaying-bool-and-integer-values.patch
Normal file
145
bz2151164-01-fix-displaying-bool-and-integer-values.patch
Normal file
@ -0,0 +1,145 @@
|
||||
From 1edf85bdabadf10708f63c0767991c7f4150e842 Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Mular <omular@redhat.com>
|
||||
Date: Wed, 7 Dec 2022 15:53:25 +0100
|
||||
Subject: [PATCH 3/3] fix displaying bool and integer values in `pcs resource
|
||||
config` command
|
||||
|
||||
---
|
||||
CHANGELOG.md | 4 ++++
|
||||
pcs/cli/resource/output.py | 18 +++++++++---------
|
||||
pcs_test/resources/cib-resources.xml | 2 +-
|
||||
pcs_test/tier1/legacy/test_resource.py | 3 ++-
|
||||
pcs_test/tools/resources_dto.py | 4 ++--
|
||||
5 files changed, 18 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/CHANGELOG.md b/CHANGELOG.md
|
||||
index ed2083af..378cca50 100644
|
||||
--- a/CHANGELOG.md
|
||||
+++ b/CHANGELOG.md
|
||||
@@ -9,7 +9,11 @@
|
||||
|
||||
### Fixed
|
||||
- Graceful stopping pcsd service using `systemctl stop pcsd` command
|
||||
+- Displaying bool and integer values in `pcs resource config` command
|
||||
+ ([rhbz#2151164], [ghissue#604])
|
||||
|
||||
+[ghissue#604]: https://github.com/ClusterLabs/pcs/issues/604
|
||||
+[rhbz#2151164]: https://bugzilla.redhat.com/show_bug.cgi?id=2151164
|
||||
[rhbz#2151524]: https://bugzilla.redhat.com/show_bug.cgi?id=2151524
|
||||
|
||||
|
||||
diff --git a/pcs/cli/resource/output.py b/pcs/cli/resource/output.py
|
||||
index daa713a0..dbdf009f 100644
|
||||
--- a/pcs/cli/resource/output.py
|
||||
+++ b/pcs/cli/resource/output.py
|
||||
@@ -69,9 +69,9 @@ def _resource_operation_to_pairs(
|
||||
pairs.append(("interval-origin", operation_dto.interval_origin))
|
||||
if operation_dto.timeout:
|
||||
pairs.append(("timeout", operation_dto.timeout))
|
||||
- if operation_dto.enabled:
|
||||
+ if operation_dto.enabled is not None:
|
||||
pairs.append(("enabled", _bool_to_cli_value(operation_dto.enabled)))
|
||||
- if operation_dto.record_pending:
|
||||
+ if operation_dto.record_pending is not None:
|
||||
pairs.append(
|
||||
("record-pending", _bool_to_cli_value(operation_dto.record_pending))
|
||||
)
|
||||
@@ -474,13 +474,13 @@ def _resource_bundle_container_options_to_pairs(
|
||||
options: CibResourceBundleContainerRuntimeOptionsDto,
|
||||
) -> List[Tuple[str, str]]:
|
||||
option_list = [("image", options.image)]
|
||||
- if options.replicas:
|
||||
+ if options.replicas is not None:
|
||||
option_list.append(("replicas", str(options.replicas)))
|
||||
- if options.replicas_per_host:
|
||||
+ if options.replicas_per_host is not None:
|
||||
option_list.append(
|
||||
("replicas-per-host", str(options.replicas_per_host))
|
||||
)
|
||||
- if options.promoted_max:
|
||||
+ if options.promoted_max is not None:
|
||||
option_list.append(("promoted-max", str(options.promoted_max)))
|
||||
if options.run_command:
|
||||
option_list.append(("run-command", options.run_command))
|
||||
@@ -505,7 +505,7 @@ def _resource_bundle_network_options_to_pairs(
|
||||
network_options.append(
|
||||
("ip-range-start", bundle_network_dto.ip_range_start)
|
||||
)
|
||||
- if bundle_network_dto.control_port:
|
||||
+ if bundle_network_dto.control_port is not None:
|
||||
network_options.append(
|
||||
("control-port", str(bundle_network_dto.control_port))
|
||||
)
|
||||
@@ -513,7 +513,7 @@ def _resource_bundle_network_options_to_pairs(
|
||||
network_options.append(
|
||||
("host-interface", bundle_network_dto.host_interface)
|
||||
)
|
||||
- if bundle_network_dto.host_netmask:
|
||||
+ if bundle_network_dto.host_netmask is not None:
|
||||
network_options.append(
|
||||
("host-netmask", str(bundle_network_dto.host_netmask))
|
||||
)
|
||||
@@ -528,9 +528,9 @@ def _resource_bundle_port_mapping_to_pairs(
|
||||
bundle_net_port_mapping_dto: CibResourceBundlePortMappingDto,
|
||||
) -> List[Tuple[str, str]]:
|
||||
mapping = []
|
||||
- if bundle_net_port_mapping_dto.port:
|
||||
+ if bundle_net_port_mapping_dto.port is not None:
|
||||
mapping.append(("port", str(bundle_net_port_mapping_dto.port)))
|
||||
- if bundle_net_port_mapping_dto.internal_port:
|
||||
+ if bundle_net_port_mapping_dto.internal_port is not None:
|
||||
mapping.append(
|
||||
("internal-port", str(bundle_net_port_mapping_dto.internal_port))
|
||||
)
|
||||
diff --git a/pcs_test/resources/cib-resources.xml b/pcs_test/resources/cib-resources.xml
|
||||
index 1e256b42..9242fd4a 100644
|
||||
--- a/pcs_test/resources/cib-resources.xml
|
||||
+++ b/pcs_test/resources/cib-resources.xml
|
||||
@@ -53,7 +53,7 @@
|
||||
</instance_attributes>
|
||||
</op>
|
||||
<op name="migrate_from" timeout="20s" interval="0s" id="R7-migrate_from-interval-0s"/>
|
||||
- <op name="migrate_to" timeout="20s" interval="0s" id="R7-migrate_to-interval-0s"/>
|
||||
+ <op name="migrate_to" timeout="20s" interval="0s" id="R7-migrate_to-interval-0s" enabled="false" record-pending="false"/>
|
||||
<op name="monitor" timeout="20s" interval="10s" id="R7-monitor-interval-10s"/>
|
||||
<op name="reload" timeout="20s" interval="0s" id="R7-reload-interval-0s"/>
|
||||
<op name="reload-agent" timeout="20s" interval="0s" id="R7-reload-agent-interval-0s"/>
|
||||
diff --git a/pcs_test/tier1/legacy/test_resource.py b/pcs_test/tier1/legacy/test_resource.py
|
||||
index c097a937..3ba32ec7 100644
|
||||
--- a/pcs_test/tier1/legacy/test_resource.py
|
||||
+++ b/pcs_test/tier1/legacy/test_resource.py
|
||||
@@ -774,7 +774,7 @@ Error: moni=tor does not appear to be a valid operation action
|
||||
|
||||
o, r = pcs(
|
||||
self.temp_cib.name,
|
||||
- "resource create --no-default-ops OPTest ocf:heartbeat:Dummy op monitor interval=30s OCF_CHECK_LEVEL=1 op monitor interval=25s OCF_CHECK_LEVEL=1".split(),
|
||||
+ "resource create --no-default-ops OPTest ocf:heartbeat:Dummy op monitor interval=30s OCF_CHECK_LEVEL=1 op monitor interval=25s OCF_CHECK_LEVEL=1 enabled=0".split(),
|
||||
)
|
||||
ac(o, "")
|
||||
assert r == 0
|
||||
@@ -791,6 +791,7 @@ Error: moni=tor does not appear to be a valid operation action
|
||||
OCF_CHECK_LEVEL=1
|
||||
monitor: OPTest-monitor-interval-25s
|
||||
interval=25s
|
||||
+ enabled=0
|
||||
OCF_CHECK_LEVEL=1
|
||||
"""
|
||||
),
|
||||
diff --git a/pcs_test/tools/resources_dto.py b/pcs_test/tools/resources_dto.py
|
||||
index e010037e..af0b4ac3 100644
|
||||
--- a/pcs_test/tools/resources_dto.py
|
||||
+++ b/pcs_test/tools/resources_dto.py
|
||||
@@ -236,8 +236,8 @@ PRIMITIVE_R7 = CibResourcePrimitiveDto(
|
||||
start_delay=None,
|
||||
interval_origin=None,
|
||||
timeout="20s",
|
||||
- enabled=None,
|
||||
- record_pending=None,
|
||||
+ enabled=False,
|
||||
+ record_pending=False,
|
||||
role=None,
|
||||
on_fail=None,
|
||||
meta_attributes=[],
|
||||
--
|
||||
2.38.1
|
||||
|
@ -0,0 +1,755 @@
|
||||
From e292dd4de2504da09901133fdab7ace5a97f9d73 Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Mular <omular@redhat.com>
|
||||
Date: Wed, 7 Dec 2022 11:33:25 +0100
|
||||
Subject: [PATCH 2/3] add warning when updating a misconfigured resource
|
||||
|
||||
---
|
||||
CHANGELOG.md | 8 ++
|
||||
pcs/common/reports/codes.py | 3 +
|
||||
pcs/common/reports/messages.py | 19 +++++
|
||||
pcs/lib/cib/resource/primitive.py | 84 ++++++++++++++-----
|
||||
pcs/lib/pacemaker/live.py | 38 ++-------
|
||||
.../tier0/common/reports/test_messages.py | 16 ++++
|
||||
.../cib/resource/test_primitive_validate.py | 56 +++++++------
|
||||
pcs_test/tier0/lib/pacemaker/test_live.py | 78 +++++------------
|
||||
pcs_test/tier1/legacy/test_stonith.py | 5 +-
|
||||
9 files changed, 169 insertions(+), 138 deletions(-)
|
||||
|
||||
diff --git a/CHANGELOG.md b/CHANGELOG.md
|
||||
index 7927eae6..ed2083af 100644
|
||||
--- a/CHANGELOG.md
|
||||
+++ b/CHANGELOG.md
|
||||
@@ -2,9 +2,17 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
+### Added
|
||||
+- Warning to `pcs resource|stonith update` commands about not using agent
|
||||
+ self-validation feature when the resource is already misconfigured
|
||||
+ ([rhbz#2151524])
|
||||
+
|
||||
### Fixed
|
||||
- Graceful stopping pcsd service using `systemctl stop pcsd` command
|
||||
|
||||
+[rhbz#2151524]: https://bugzilla.redhat.com/show_bug.cgi?id=2151524
|
||||
+
|
||||
+
|
||||
## [0.11.4] - 2022-11-21
|
||||
|
||||
### Security
|
||||
diff --git a/pcs/common/reports/codes.py b/pcs/common/reports/codes.py
|
||||
index 76963733..90609f47 100644
|
||||
--- a/pcs/common/reports/codes.py
|
||||
+++ b/pcs/common/reports/codes.py
|
||||
@@ -44,6 +44,9 @@ AGENT_NAME_GUESS_FOUND_MORE_THAN_ONE = M("AGENT_NAME_GUESS_FOUND_MORE_THAN_ONE")
|
||||
AGENT_NAME_GUESS_FOUND_NONE = M("AGENT_NAME_GUESS_FOUND_NONE")
|
||||
AGENT_NAME_GUESSED = M("AGENT_NAME_GUESSED")
|
||||
AGENT_SELF_VALIDATION_INVALID_DATA = M("AGENT_SELF_VALIDATION_INVALID_DATA")
|
||||
+AGENT_SELF_VALIDATION_SKIPPED_UPDATED_RESOURCE_MISCONFIGURED = M(
|
||||
+ "AGENT_SELF_VALIDATION_SKIPPED_UPDATED_RESOURCE_MISCONFIGURED"
|
||||
+)
|
||||
AGENT_SELF_VALIDATION_RESULT = M("AGENT_SELF_VALIDATION_RESULT")
|
||||
BAD_CLUSTER_STATE_FORMAT = M("BAD_CLUSTER_STATE_FORMAT")
|
||||
BOOTH_ADDRESS_DUPLICATION = M("BOOTH_ADDRESS_DUPLICATION")
|
||||
diff --git a/pcs/common/reports/messages.py b/pcs/common/reports/messages.py
|
||||
index ba748eb2..fbc4de62 100644
|
||||
--- a/pcs/common/reports/messages.py
|
||||
+++ b/pcs/common/reports/messages.py
|
||||
@@ -7494,6 +7494,25 @@ class AgentSelfValidationInvalidData(ReportItemMessage):
|
||||
return f"Invalid validation data from agent: {self.reason}"
|
||||
|
||||
|
||||
+@dataclass(frozen=True)
|
||||
+class AgentSelfValidationSkippedUpdatedResourceMisconfigured(ReportItemMessage):
|
||||
+ """
|
||||
+ Agent self validation is skipped when updating a resource as it is
|
||||
+ misconfigured in its current state.
|
||||
+ """
|
||||
+
|
||||
+ result: str
|
||||
+ _code = codes.AGENT_SELF_VALIDATION_SKIPPED_UPDATED_RESOURCE_MISCONFIGURED
|
||||
+
|
||||
+ @property
|
||||
+ def message(self) -> str:
|
||||
+ return (
|
||||
+ "The resource was misconfigured before the update, therefore agent "
|
||||
+ "self-validation will not be run for the updated configuration. "
|
||||
+ "Validation output of the original configuration:\n{result}"
|
||||
+ ).format(result="\n".join(indent(self.result.splitlines())))
|
||||
+
|
||||
+
|
||||
@dataclass(frozen=True)
|
||||
class ResourceCloneIncompatibleMetaAttributes(ReportItemMessage):
|
||||
"""
|
||||
diff --git a/pcs/lib/cib/resource/primitive.py b/pcs/lib/cib/resource/primitive.py
|
||||
index d9940e9d..f9d52b9b 100644
|
||||
--- a/pcs/lib/cib/resource/primitive.py
|
||||
+++ b/pcs/lib/cib/resource/primitive.py
|
||||
@@ -357,6 +357,31 @@ def _is_ocf_or_stonith_agent(resource_agent_name: ResourceAgentName) -> bool:
|
||||
return resource_agent_name.standard in ("stonith", "ocf")
|
||||
|
||||
|
||||
+def _get_report_from_agent_self_validation(
|
||||
+ is_valid: Optional[bool],
|
||||
+ reason: str,
|
||||
+ report_severity: reports.ReportItemSeverity,
|
||||
+) -> reports.ReportItemList:
|
||||
+ report_items = []
|
||||
+ if is_valid is None:
|
||||
+ report_items.append(
|
||||
+ reports.ReportItem(
|
||||
+ report_severity,
|
||||
+ reports.messages.AgentSelfValidationInvalidData(reason),
|
||||
+ )
|
||||
+ )
|
||||
+ elif not is_valid or reason:
|
||||
+ if is_valid:
|
||||
+ report_severity = reports.ReportItemSeverity.warning()
|
||||
+ report_items.append(
|
||||
+ reports.ReportItem(
|
||||
+ report_severity,
|
||||
+ reports.messages.AgentSelfValidationResult(reason),
|
||||
+ )
|
||||
+ )
|
||||
+ return report_items
|
||||
+
|
||||
+
|
||||
def validate_resource_instance_attributes_create(
|
||||
cmd_runner: CommandRunner,
|
||||
resource_agent: ResourceAgentFacade,
|
||||
@@ -405,16 +430,16 @@ def validate_resource_instance_attributes_create(
|
||||
for report_item in report_items
|
||||
)
|
||||
):
|
||||
- (
|
||||
- dummy_is_valid,
|
||||
- agent_validation_reports,
|
||||
- ) = validate_resource_instance_attributes_via_pcmk(
|
||||
- cmd_runner,
|
||||
- agent_name,
|
||||
- instance_attributes,
|
||||
- reports.get_severity(reports.codes.FORCE, force),
|
||||
+ report_items.extend(
|
||||
+ _get_report_from_agent_self_validation(
|
||||
+ *validate_resource_instance_attributes_via_pcmk(
|
||||
+ cmd_runner,
|
||||
+ agent_name,
|
||||
+ instance_attributes,
|
||||
+ ),
|
||||
+ reports.get_severity(reports.codes.FORCE, force),
|
||||
+ )
|
||||
)
|
||||
- report_items.extend(agent_validation_reports)
|
||||
return report_items
|
||||
|
||||
|
||||
@@ -508,25 +533,40 @@ def validate_resource_instance_attributes_update(
|
||||
)
|
||||
):
|
||||
(
|
||||
- is_valid,
|
||||
- dummy_reports,
|
||||
+ original_is_valid,
|
||||
+ original_reason,
|
||||
) = validate_resource_instance_attributes_via_pcmk(
|
||||
cmd_runner,
|
||||
agent_name,
|
||||
current_instance_attrs,
|
||||
- reports.ReportItemSeverity.error(),
|
||||
)
|
||||
- if is_valid:
|
||||
- (
|
||||
- dummy_is_valid,
|
||||
- agent_validation_reports,
|
||||
- ) = validate_resource_instance_attributes_via_pcmk(
|
||||
- cmd_runner,
|
||||
- resource_agent.metadata.name,
|
||||
- final_attrs,
|
||||
- reports.get_severity(reports.codes.FORCE, force),
|
||||
+ if original_is_valid:
|
||||
+ report_items.extend(
|
||||
+ _get_report_from_agent_self_validation(
|
||||
+ *validate_resource_instance_attributes_via_pcmk(
|
||||
+ cmd_runner,
|
||||
+ resource_agent.metadata.name,
|
||||
+ final_attrs,
|
||||
+ ),
|
||||
+ reports.get_severity(reports.codes.FORCE, force),
|
||||
+ )
|
||||
+ )
|
||||
+ elif original_is_valid is None:
|
||||
+ report_items.append(
|
||||
+ reports.ReportItem.warning(
|
||||
+ reports.messages.AgentSelfValidationInvalidData(
|
||||
+ original_reason
|
||||
+ )
|
||||
+ )
|
||||
+ )
|
||||
+ else:
|
||||
+ report_items.append(
|
||||
+ reports.ReportItem.warning(
|
||||
+ reports.messages.AgentSelfValidationSkippedUpdatedResourceMisconfigured(
|
||||
+ original_reason
|
||||
+ )
|
||||
+ )
|
||||
)
|
||||
- report_items.extend(agent_validation_reports)
|
||||
return report_items
|
||||
|
||||
|
||||
diff --git a/pcs/lib/pacemaker/live.py b/pcs/lib/pacemaker/live.py
|
||||
index 6dab613e..fb1e0a4a 100644
|
||||
--- a/pcs/lib/pacemaker/live.py
|
||||
+++ b/pcs/lib/pacemaker/live.py
|
||||
@@ -884,8 +884,7 @@ def _validate_stonith_instance_attributes_via_pcmk(
|
||||
cmd_runner: CommandRunner,
|
||||
agent_name: ResourceAgentName,
|
||||
instance_attributes: Mapping[str, str],
|
||||
- not_valid_severity: reports.ReportItemSeverity,
|
||||
-) -> tuple[Optional[bool], reports.ReportItemList]:
|
||||
+) -> tuple[Optional[bool], str]:
|
||||
cmd = [
|
||||
settings.stonith_admin,
|
||||
"--validate",
|
||||
@@ -899,7 +898,6 @@ def _validate_stonith_instance_attributes_via_pcmk(
|
||||
cmd,
|
||||
"./validate/command/output",
|
||||
instance_attributes,
|
||||
- not_valid_severity,
|
||||
)
|
||||
|
||||
|
||||
@@ -907,8 +905,7 @@ def _validate_resource_instance_attributes_via_pcmk(
|
||||
cmd_runner: CommandRunner,
|
||||
agent_name: ResourceAgentName,
|
||||
instance_attributes: Mapping[str, str],
|
||||
- not_valid_severity: reports.ReportItemSeverity,
|
||||
-) -> tuple[Optional[bool], reports.ReportItemList]:
|
||||
+) -> tuple[Optional[bool], str]:
|
||||
cmd = [
|
||||
settings.crm_resource_binary,
|
||||
"--validate",
|
||||
@@ -926,7 +923,6 @@ def _validate_resource_instance_attributes_via_pcmk(
|
||||
cmd,
|
||||
"./resource-agent-action/command/output",
|
||||
instance_attributes,
|
||||
- not_valid_severity,
|
||||
)
|
||||
|
||||
|
||||
@@ -935,8 +931,7 @@ def _handle_instance_attributes_validation_via_pcmk(
|
||||
cmd: StringSequence,
|
||||
data_xpath: str,
|
||||
instance_attributes: Mapping[str, str],
|
||||
- not_valid_severity: reports.ReportItemSeverity,
|
||||
-) -> tuple[Optional[bool], reports.ReportItemList]:
|
||||
+) -> tuple[Optional[bool], str]:
|
||||
full_cmd = list(cmd)
|
||||
for key, value in sorted(instance_attributes.items()):
|
||||
full_cmd.extend(["--option", f"{key}={value}"])
|
||||
@@ -945,12 +940,7 @@ def _handle_instance_attributes_validation_via_pcmk(
|
||||
# dom = _get_api_result_dom(stdout)
|
||||
dom = xml_fromstring(stdout)
|
||||
except (etree.XMLSyntaxError, etree.DocumentInvalid) as e:
|
||||
- return None, [
|
||||
- reports.ReportItem(
|
||||
- not_valid_severity,
|
||||
- reports.messages.AgentSelfValidationInvalidData(str(e)),
|
||||
- )
|
||||
- ]
|
||||
+ return None, str(e)
|
||||
result = "\n".join(
|
||||
"\n".join(
|
||||
line.strip() for line in item.text.split("\n") if line.strip()
|
||||
@@ -958,38 +948,22 @@ def _handle_instance_attributes_validation_via_pcmk(
|
||||
for item in dom.iterfind(data_xpath)
|
||||
if item.get("source") == "stderr" and item.text
|
||||
).strip()
|
||||
- if return_value == 0:
|
||||
- if result:
|
||||
- return True, [
|
||||
- reports.ReportItem.warning(
|
||||
- reports.messages.AgentSelfValidationResult(result)
|
||||
- )
|
||||
- ]
|
||||
- return True, []
|
||||
- return False, [
|
||||
- reports.ReportItem(
|
||||
- not_valid_severity,
|
||||
- reports.messages.AgentSelfValidationResult(result),
|
||||
- )
|
||||
- ]
|
||||
+ return return_value == 0, result
|
||||
|
||||
|
||||
def validate_resource_instance_attributes_via_pcmk(
|
||||
cmd_runner: CommandRunner,
|
||||
resource_agent_name: ResourceAgentName,
|
||||
instance_attributes: Mapping[str, str],
|
||||
- not_valid_severity: reports.ReportItemSeverity,
|
||||
-) -> tuple[Optional[bool], reports.ReportItemList]:
|
||||
+) -> tuple[Optional[bool], str]:
|
||||
if resource_agent_name.is_stonith:
|
||||
return _validate_stonith_instance_attributes_via_pcmk(
|
||||
cmd_runner,
|
||||
resource_agent_name,
|
||||
instance_attributes,
|
||||
- not_valid_severity,
|
||||
)
|
||||
return _validate_resource_instance_attributes_via_pcmk(
|
||||
cmd_runner,
|
||||
resource_agent_name,
|
||||
instance_attributes,
|
||||
- not_valid_severity,
|
||||
)
|
||||
diff --git a/pcs_test/tier0/common/reports/test_messages.py b/pcs_test/tier0/common/reports/test_messages.py
|
||||
index 64e74daa..b1e009ce 100644
|
||||
--- a/pcs_test/tier0/common/reports/test_messages.py
|
||||
+++ b/pcs_test/tier0/common/reports/test_messages.py
|
||||
@@ -5525,6 +5525,22 @@ class AgentSelfValidationInvalidData(NameBuildTest):
|
||||
)
|
||||
|
||||
|
||||
+class AgentSelfValidationSkippedUpdatedResourceMisconfigured(NameBuildTest):
|
||||
+ def test_message(self):
|
||||
+ lines = list(f"line #{i}" for i in range(3))
|
||||
+ self.assert_message_from_report(
|
||||
+ (
|
||||
+ "The resource was misconfigured before the update, therefore "
|
||||
+ "agent self-validation will not be run for the updated "
|
||||
+ "configuration. Validation output of the original "
|
||||
+ "configuration:\n {}"
|
||||
+ ).format("\n ".join(lines)),
|
||||
+ reports.AgentSelfValidationSkippedUpdatedResourceMisconfigured(
|
||||
+ "\n".join(lines)
|
||||
+ ),
|
||||
+ )
|
||||
+
|
||||
+
|
||||
class ResourceCloneIncompatibleMetaAttributes(NameBuildTest):
|
||||
def test_with_provider(self):
|
||||
attr = "attr_name"
|
||||
diff --git a/pcs_test/tier0/lib/cib/resource/test_primitive_validate.py b/pcs_test/tier0/lib/cib/resource/test_primitive_validate.py
|
||||
index 8b52314f..7a4e5c8f 100644
|
||||
--- a/pcs_test/tier0/lib/cib/resource/test_primitive_validate.py
|
||||
+++ b/pcs_test/tier0/lib/cib/resource/test_primitive_validate.py
|
||||
@@ -660,7 +660,6 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
|
||||
self.cmd_runner,
|
||||
facade.metadata.name,
|
||||
attributes,
|
||||
- reports.ReportItemSeverity.error(reports.codes.FORCE),
|
||||
)
|
||||
|
||||
def test_force(self):
|
||||
@@ -680,15 +679,14 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
|
||||
self.cmd_runner,
|
||||
facade.metadata.name,
|
||||
attributes,
|
||||
- reports.ReportItemSeverity.warning(),
|
||||
)
|
||||
|
||||
def test_failure(self):
|
||||
attributes = {"required": "value"}
|
||||
facade = _fixture_ocf_agent()
|
||||
- failure_reports = ["report1", "report2"]
|
||||
- self.agent_self_validation_mock.return_value = False, failure_reports
|
||||
- self.assertEqual(
|
||||
+ failure_reason = "failure reason"
|
||||
+ self.agent_self_validation_mock.return_value = False, failure_reason
|
||||
+ assert_report_item_list_equal(
|
||||
primitive.validate_resource_instance_attributes_create(
|
||||
self.cmd_runner,
|
||||
facade,
|
||||
@@ -696,13 +694,18 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
|
||||
etree.Element("resources"),
|
||||
force=False,
|
||||
),
|
||||
- failure_reports,
|
||||
+ [
|
||||
+ fixture.error(
|
||||
+ reports.codes.AGENT_SELF_VALIDATION_RESULT,
|
||||
+ result=failure_reason,
|
||||
+ force_code=reports.codes.FORCE,
|
||||
+ )
|
||||
+ ],
|
||||
)
|
||||
self.agent_self_validation_mock.assert_called_once_with(
|
||||
self.cmd_runner,
|
||||
facade.metadata.name,
|
||||
attributes,
|
||||
- reports.ReportItemSeverity.error(reports.codes.FORCE),
|
||||
)
|
||||
|
||||
def test_stonith_check(self):
|
||||
@@ -722,7 +725,6 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
|
||||
self.cmd_runner,
|
||||
facade.metadata.name,
|
||||
attributes,
|
||||
- reports.ReportItemSeverity.error(reports.codes.FORCE),
|
||||
)
|
||||
|
||||
def test_nonexisting_agent(self):
|
||||
@@ -1346,13 +1348,11 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
|
||||
self.cmd_runner,
|
||||
facade.metadata.name,
|
||||
old_attributes,
|
||||
- reports.ReportItemSeverity.error(),
|
||||
),
|
||||
mock.call(
|
||||
self.cmd_runner,
|
||||
facade.metadata.name,
|
||||
new_attributes,
|
||||
- reports.ReportItemSeverity.error(reports.codes.FORCE),
|
||||
),
|
||||
],
|
||||
)
|
||||
@@ -1379,13 +1379,11 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
|
||||
self.cmd_runner,
|
||||
facade.metadata.name,
|
||||
old_attributes,
|
||||
- reports.ReportItemSeverity.error(),
|
||||
),
|
||||
mock.call(
|
||||
self.cmd_runner,
|
||||
facade.metadata.name,
|
||||
new_attributes,
|
||||
- reports.ReportItemSeverity.warning(),
|
||||
),
|
||||
],
|
||||
)
|
||||
@@ -1393,13 +1391,13 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
|
||||
def test_failure(self):
|
||||
old_attributes = {"required": "old_value"}
|
||||
new_attributes = {"required": "new_value"}
|
||||
- failure_reports = ["report1", "report2"]
|
||||
+ failure_reason = "failure reason"
|
||||
facade = _fixture_ocf_agent()
|
||||
self.agent_self_validation_mock.side_effect = (
|
||||
- (True, []),
|
||||
- (False, failure_reports),
|
||||
+ (True, ""),
|
||||
+ (False, failure_reason),
|
||||
)
|
||||
- self.assertEqual(
|
||||
+ assert_report_item_list_equal(
|
||||
primitive.validate_resource_instance_attributes_update(
|
||||
self.cmd_runner,
|
||||
facade,
|
||||
@@ -1408,7 +1406,13 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
|
||||
self._fixture_resources(old_attributes),
|
||||
force=False,
|
||||
),
|
||||
- failure_reports,
|
||||
+ [
|
||||
+ fixture.error(
|
||||
+ reports.codes.AGENT_SELF_VALIDATION_RESULT,
|
||||
+ result=failure_reason,
|
||||
+ force_code=reports.codes.FORCE,
|
||||
+ )
|
||||
+ ],
|
||||
)
|
||||
self.assertEqual(
|
||||
self.agent_self_validation_mock.mock_calls,
|
||||
@@ -1417,13 +1421,11 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
|
||||
self.cmd_runner,
|
||||
facade.metadata.name,
|
||||
old_attributes,
|
||||
- reports.ReportItemSeverity.error(),
|
||||
),
|
||||
mock.call(
|
||||
self.cmd_runner,
|
||||
facade.metadata.name,
|
||||
new_attributes,
|
||||
- reports.ReportItemSeverity.error(reports.codes.FORCE),
|
||||
),
|
||||
],
|
||||
)
|
||||
@@ -1450,13 +1452,11 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
|
||||
self.cmd_runner,
|
||||
facade.metadata.name,
|
||||
old_attributes,
|
||||
- reports.ReportItemSeverity.error(),
|
||||
),
|
||||
mock.call(
|
||||
self.cmd_runner,
|
||||
facade.metadata.name,
|
||||
new_attributes,
|
||||
- reports.ReportItemSeverity.error(reports.codes.FORCE),
|
||||
),
|
||||
],
|
||||
)
|
||||
@@ -1522,10 +1522,10 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
|
||||
def test_current_attributes_failure(self):
|
||||
old_attributes = {"required": "old_value"}
|
||||
new_attributes = {"required": "new_value"}
|
||||
- failure_reports = ["report1", "report2"]
|
||||
+ failure_reason = "failure reason"
|
||||
facade = _fixture_ocf_agent()
|
||||
- self.agent_self_validation_mock.return_value = False, failure_reports
|
||||
- self.assertEqual(
|
||||
+ self.agent_self_validation_mock.return_value = False, failure_reason
|
||||
+ assert_report_item_list_equal(
|
||||
primitive.validate_resource_instance_attributes_update(
|
||||
self.cmd_runner,
|
||||
facade,
|
||||
@@ -1534,7 +1534,12 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
|
||||
self._fixture_resources(old_attributes),
|
||||
force=False,
|
||||
),
|
||||
- [],
|
||||
+ [
|
||||
+ fixture.warn(
|
||||
+ reports.codes.AGENT_SELF_VALIDATION_SKIPPED_UPDATED_RESOURCE_MISCONFIGURED,
|
||||
+ result=failure_reason,
|
||||
+ )
|
||||
+ ],
|
||||
)
|
||||
self.assertEqual(
|
||||
self.agent_self_validation_mock.mock_calls,
|
||||
@@ -1543,7 +1548,6 @@ class ValidateResourceInstanceAttributesUpdateSelfValidation(TestCase):
|
||||
self.cmd_runner,
|
||||
facade.metadata.name,
|
||||
old_attributes,
|
||||
- reports.ReportItemSeverity.error(),
|
||||
),
|
||||
],
|
||||
)
|
||||
diff --git a/pcs_test/tier0/lib/pacemaker/test_live.py b/pcs_test/tier0/lib/pacemaker/test_live.py
|
||||
index 1f37d759..c1363a65 100644
|
||||
--- a/pcs_test/tier0/lib/pacemaker/test_live.py
|
||||
+++ b/pcs_test/tier0/lib/pacemaker/test_live.py
|
||||
@@ -1706,16 +1706,15 @@ class HandleInstanceAttributesValidateViaPcmkTest(TestCase):
|
||||
base_cmd = ["some", "command"]
|
||||
(
|
||||
is_valid,
|
||||
- report_list,
|
||||
+ reason,
|
||||
) = lib._handle_instance_attributes_validation_via_pcmk(
|
||||
runner,
|
||||
base_cmd,
|
||||
"result/output",
|
||||
{"attr1": "val1", "attr2": "val2"},
|
||||
- not_valid_severity=Severity.info(),
|
||||
)
|
||||
self.assertTrue(is_valid)
|
||||
- self.assertEqual(report_list, [])
|
||||
+ self.assertEqual(reason, "")
|
||||
runner.run.assert_called_once_with(
|
||||
base_cmd + ["--option", "attr1=val1", "--option", "attr2=val2"]
|
||||
)
|
||||
@@ -1725,23 +1724,17 @@ class HandleInstanceAttributesValidateViaPcmkTest(TestCase):
|
||||
base_cmd = ["some", "command"]
|
||||
(
|
||||
is_valid,
|
||||
- report_list,
|
||||
+ reason,
|
||||
) = lib._handle_instance_attributes_validation_via_pcmk(
|
||||
runner,
|
||||
base_cmd,
|
||||
"result/output",
|
||||
{"attr1": "val1", "attr2": "val2"},
|
||||
- not_valid_severity=Severity.info(),
|
||||
)
|
||||
self.assertIsNone(is_valid)
|
||||
- assert_report_item_list_equal(
|
||||
- report_list,
|
||||
- [
|
||||
- fixture.info(
|
||||
- report_codes.AGENT_SELF_VALIDATION_INVALID_DATA,
|
||||
- reason="Start tag expected, '<' not found, line 1, column 1 (<string>, line 1)",
|
||||
- )
|
||||
- ],
|
||||
+ self.assertEqual(
|
||||
+ reason,
|
||||
+ "Start tag expected, '<' not found, line 1, column 1 (<string>, line 1)",
|
||||
)
|
||||
runner.run.assert_called_once_with(
|
||||
base_cmd + ["--option", "attr1=val1", "--option", "attr2=val2"]
|
||||
@@ -1760,19 +1753,15 @@ class HandleInstanceAttributesValidateViaPcmkTest(TestCase):
|
||||
base_cmd = ["some", "command"]
|
||||
(
|
||||
is_valid,
|
||||
- report_list,
|
||||
+ reason,
|
||||
) = lib._handle_instance_attributes_validation_via_pcmk(
|
||||
runner,
|
||||
base_cmd,
|
||||
"result/output",
|
||||
{"attr1": "val1", "attr2": "val2"},
|
||||
- not_valid_severity=Severity.info(),
|
||||
)
|
||||
self.assertTrue(is_valid)
|
||||
- assert_report_item_list_equal(
|
||||
- report_list,
|
||||
- [],
|
||||
- )
|
||||
+ self.assertEqual(reason, "")
|
||||
runner.run.assert_called_once_with(
|
||||
base_cmd + ["--option", "attr1=val1", "--option", "attr2=val2"]
|
||||
)
|
||||
@@ -1791,23 +1780,15 @@ class HandleInstanceAttributesValidateViaPcmkTest(TestCase):
|
||||
base_cmd = ["some", "command"]
|
||||
(
|
||||
is_valid,
|
||||
- report_list,
|
||||
+ reason,
|
||||
) = lib._handle_instance_attributes_validation_via_pcmk(
|
||||
runner,
|
||||
base_cmd,
|
||||
"result/output",
|
||||
{"attr1": "val1", "attr2": "val2"},
|
||||
- not_valid_severity=Severity.info(),
|
||||
)
|
||||
self.assertFalse(is_valid)
|
||||
- assert_report_item_list_equal(
|
||||
- report_list,
|
||||
- [
|
||||
- fixture.info(
|
||||
- report_codes.AGENT_SELF_VALIDATION_RESULT, result=""
|
||||
- )
|
||||
- ],
|
||||
- )
|
||||
+ self.assertEqual(reason, "")
|
||||
runner.run.assert_called_once_with(
|
||||
base_cmd + ["--option", "attr1=val1", "--option", "attr2=val2"]
|
||||
)
|
||||
@@ -1835,23 +1816,17 @@ class HandleInstanceAttributesValidateViaPcmkTest(TestCase):
|
||||
base_cmd = ["some", "command"]
|
||||
(
|
||||
is_valid,
|
||||
- report_list,
|
||||
+ reason,
|
||||
) = lib._handle_instance_attributes_validation_via_pcmk(
|
||||
runner,
|
||||
base_cmd,
|
||||
"result/output",
|
||||
{"attr1": "val1", "attr2": "val2"},
|
||||
- not_valid_severity=Severity.info(),
|
||||
)
|
||||
self.assertFalse(is_valid)
|
||||
- assert_report_item_list_equal(
|
||||
- report_list,
|
||||
- [
|
||||
- fixture.info(
|
||||
- report_codes.AGENT_SELF_VALIDATION_RESULT,
|
||||
- result="first line\nImportant output\nand another line",
|
||||
- )
|
||||
- ],
|
||||
+ self.assertEqual(
|
||||
+ reason,
|
||||
+ "first line\nImportant output\nand another line",
|
||||
)
|
||||
runner.run.assert_called_once_with(
|
||||
base_cmd + ["--option", "attr1=val1", "--option", "attr2=val2"]
|
||||
@@ -1879,23 +1854,17 @@ class HandleInstanceAttributesValidateViaPcmkTest(TestCase):
|
||||
base_cmd = ["some", "command"]
|
||||
(
|
||||
is_valid,
|
||||
- report_list,
|
||||
+ reason,
|
||||
) = lib._handle_instance_attributes_validation_via_pcmk(
|
||||
runner,
|
||||
base_cmd,
|
||||
"result/output",
|
||||
{"attr1": "val1", "attr2": "val2"},
|
||||
- not_valid_severity=Severity.info(),
|
||||
)
|
||||
self.assertTrue(is_valid)
|
||||
- assert_report_item_list_equal(
|
||||
- report_list,
|
||||
- [
|
||||
- fixture.warn(
|
||||
- report_codes.AGENT_SELF_VALIDATION_RESULT,
|
||||
- result="first line\nImportant output\nand another line",
|
||||
- )
|
||||
- ],
|
||||
+ self.assertEqual(
|
||||
+ reason,
|
||||
+ "first line\nImportant output\nand another line",
|
||||
)
|
||||
runner.run.assert_called_once_with(
|
||||
base_cmd + ["--option", "attr1=val1", "--option", "attr2=val2"]
|
||||
@@ -1907,7 +1876,6 @@ class ValidateResourceInstanceAttributesViaPcmkTest(TestCase):
|
||||
def setUp(self):
|
||||
self.runner = mock.Mock()
|
||||
self.attrs = dict(attra="val1", attrb="val2")
|
||||
- self.severity = Severity.info()
|
||||
patcher = mock.patch(
|
||||
"pcs.lib.pacemaker.live._handle_instance_attributes_validation_via_pcmk"
|
||||
)
|
||||
@@ -1921,7 +1889,7 @@ class ValidateResourceInstanceAttributesViaPcmkTest(TestCase):
|
||||
)
|
||||
self.assertEqual(
|
||||
lib._validate_resource_instance_attributes_via_pcmk(
|
||||
- self.runner, agent, self.attrs, self.severity
|
||||
+ self.runner, agent, self.attrs
|
||||
),
|
||||
self.ret_val,
|
||||
)
|
||||
@@ -1941,7 +1909,6 @@ class ValidateResourceInstanceAttributesViaPcmkTest(TestCase):
|
||||
],
|
||||
"./resource-agent-action/command/output",
|
||||
self.attrs,
|
||||
- self.severity,
|
||||
)
|
||||
|
||||
def test_without_provider(self):
|
||||
@@ -1950,7 +1917,7 @@ class ValidateResourceInstanceAttributesViaPcmkTest(TestCase):
|
||||
)
|
||||
self.assertEqual(
|
||||
lib._validate_resource_instance_attributes_via_pcmk(
|
||||
- self.runner, agent, self.attrs, self.severity
|
||||
+ self.runner, agent, self.attrs
|
||||
),
|
||||
self.ret_val,
|
||||
)
|
||||
@@ -1968,7 +1935,6 @@ class ValidateResourceInstanceAttributesViaPcmkTest(TestCase):
|
||||
],
|
||||
"./resource-agent-action/command/output",
|
||||
self.attrs,
|
||||
- self.severity,
|
||||
)
|
||||
|
||||
|
||||
@@ -1978,7 +1944,6 @@ class ValidateStonithInstanceAttributesViaPcmkTest(TestCase):
|
||||
def setUp(self):
|
||||
self.runner = mock.Mock()
|
||||
self.attrs = dict(attra="val1", attrb="val2")
|
||||
- self.severity = Severity.info()
|
||||
patcher = mock.patch(
|
||||
"pcs.lib.pacemaker.live._handle_instance_attributes_validation_via_pcmk"
|
||||
)
|
||||
@@ -1992,7 +1957,7 @@ class ValidateStonithInstanceAttributesViaPcmkTest(TestCase):
|
||||
)
|
||||
self.assertEqual(
|
||||
lib._validate_stonith_instance_attributes_via_pcmk(
|
||||
- self.runner, agent, self.attrs, self.severity
|
||||
+ self.runner, agent, self.attrs
|
||||
),
|
||||
self.ret_val,
|
||||
)
|
||||
@@ -2008,5 +1973,4 @@ class ValidateStonithInstanceAttributesViaPcmkTest(TestCase):
|
||||
],
|
||||
"./validate/command/output",
|
||||
self.attrs,
|
||||
- self.severity,
|
||||
)
|
||||
diff --git a/pcs_test/tier1/legacy/test_stonith.py b/pcs_test/tier1/legacy/test_stonith.py
|
||||
index 8b31094b..7e7ec030 100644
|
||||
--- a/pcs_test/tier1/legacy/test_stonith.py
|
||||
+++ b/pcs_test/tier1/legacy/test_stonith.py
|
||||
@@ -1291,7 +1291,10 @@ class StonithTest(TestCase, AssertPcsMixin):
|
||||
),
|
||||
)
|
||||
|
||||
- self.assert_pcs_success("stonith update test3 username=testA".split())
|
||||
+ self.assert_pcs_success(
|
||||
+ "stonith update test3 username=testA".split(),
|
||||
+ stdout_start="Warning: ",
|
||||
+ )
|
||||
|
||||
self.assert_pcs_success(
|
||||
"stonith config test2".split(),
|
||||
--
|
||||
2.38.1
|
||||
|
32
pcs.spec
32
pcs.spec
@ -1,17 +1,17 @@
|
||||
Name: pcs
|
||||
Version: 0.11.4
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
# https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/
|
||||
# https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses
|
||||
# GPL-2.0-only: pcs
|
||||
# Apache-2.0: tornado
|
||||
# MIT: backports, childprocess, dacite, daemons, ethon, mustermann, rack,
|
||||
# rack-protection, rack-test, sinatra, tilt
|
||||
# GPL-2.0-only or Ruby: eventmachne
|
||||
# (GPL-2.0-only or Ruby) and BSD: thin
|
||||
# GPL-2.0-only or Ruby: eventmachine
|
||||
# (GPL-2.0-only or Ruby) and BSD-2-Clause: thin
|
||||
# BSD-2-Clause or Ruby: ruby2_keywords, webrick
|
||||
# BSD-3-Clause and MIT: ffi
|
||||
License: GPL-2.0-only AND Apache-2.0 AND MIT AND BSD-3-Clause AND (GPL-2.0-only OR Ruby) AND (BSD-2-Clause OR Ruby)
|
||||
License: GPL-2.0-only AND Apache-2.0 AND MIT AND BSD-3-Clause AND (GPL-2.0-only OR Ruby) AND BSD-2-Clause AND (BSD-2-Clause OR Ruby)
|
||||
URL: https://github.com/ClusterLabs/pcs
|
||||
Group: System Environment/Base
|
||||
Summary: Pacemaker Configuration System
|
||||
@ -36,15 +36,15 @@ ExclusiveArch: i686 x86_64 s390x ppc64le aarch64
|
||||
%global version_rubygem_backports 3.23.0
|
||||
%global version_rubygem_childprocess 4.1.0
|
||||
%global version_rubygem_daemons 1.4.1
|
||||
%global version_rubygem_ethon 0.15.0
|
||||
%global version_rubygem_ethon 0.16.0
|
||||
%global version_rubygem_eventmachine 1.2.7
|
||||
%global version_rubygem_ffi 1.15.5
|
||||
%global version_rubygem_mustermann 3.0.0
|
||||
%global version_rubygem_rack 2.2.4
|
||||
%global version_rubygem_rack_protection 3.0.2
|
||||
%global version_rubygem_rack_protection 3.0.4
|
||||
%global version_rubygem_rack_test 2.0.2
|
||||
%global version_rubygem_ruby2_keywords 0.0.5
|
||||
%global version_rubygem_sinatra 3.0.2
|
||||
%global version_rubygem_sinatra 3.0.4
|
||||
%global version_rubygem_thin 1.8.1
|
||||
%global version_rubygem_tilt 2.0.11
|
||||
%global version_rubygem_webrick 1.7.0
|
||||
@ -107,6 +107,11 @@ Source101: https://github.com/ClusterLabs/pcs-web-ui/releases/download/%{ui_comm
|
||||
|
||||
# pcs patches: <= 200
|
||||
Patch1: do-not-support-cluster-setup-with-udp-u-transport.patch
|
||||
Patch2: bz2148124-01-pcsd-systemd-killmode.patch
|
||||
Patch3: 01-smoke-test-fix.patch
|
||||
Patch4: 02-smoke-test-fix.patch
|
||||
Patch5: bz2151524-01-add-warning-when-updating-a-misconfigured-resource.patch
|
||||
Patch6: bz2151164-01-fix-displaying-bool-and-integer-values.patch
|
||||
|
||||
# ui patches: >200
|
||||
# Patch201: bzNUMBER-01-name.patch
|
||||
@ -291,6 +296,11 @@ update_times_patch(){
|
||||
%autosetup -S git -n %{pcs_source_name} -N
|
||||
%autopatch -p1 -M 200
|
||||
update_times_patch %{PATCH1}
|
||||
update_times_patch %{PATCH2}
|
||||
update_times_patch %{PATCH3}
|
||||
update_times_patch %{PATCH4}
|
||||
update_times_patch %{PATCH5}
|
||||
update_times_patch %{PATCH6}
|
||||
|
||||
# prepare dirs/files necessary for building all bundles
|
||||
# -----------------------------------------------------
|
||||
@ -523,6 +533,14 @@ run_all_tests
|
||||
%license pyagentx_LICENSE.txt
|
||||
|
||||
%changelog
|
||||
* Wed Dec 14 2022 Michal Pospisil <mpospisi@redhat.com> - 0.11.4-2
|
||||
- Fixed stopping of pcsd service using systemctl stop pcsd command
|
||||
- Fixed smoke test execution during gating
|
||||
- Added warning when omitting validation of misconfigured resource
|
||||
- Fixed displaying of bool and integer values in `pcs resource config` command
|
||||
- Updated bundled rubygems: ethon, rack-protection, sinatra
|
||||
- Resolves: rhbz#2148124 rhbz#2151164 rhbz#2151524
|
||||
|
||||
* Tue Nov 22 2022 Michal Pospisil <mpospisi@redhat.com> - 0.11.4-1
|
||||
- Rebased to latest upstream sources (see CHANGELOG.md)
|
||||
- Updated pcs-web-ui
|
||||
|
6
sources
6
sources
@ -3,7 +3,6 @@ SHA512 (eventmachine-1.2.7.gem) = fdbcf9fc933e2414e70f8f48153e9ba6ed7a0029cdf49c
|
||||
SHA512 (dacite-1.6.0.tar.gz) = 034255f095589d309fe5805413d8b148f430cd20a0de305b7954083b530d516da1d8f3f00ebb5264a8cfb77f2b2a76f1e2d863e78bd191f1d85021c5553815da
|
||||
SHA512 (backports-3.23.0.gem) = b6d721a2925a932e451437938e01c6e3f4ac08bafac975063963f7866e17015abfeb6862face89cbd08caf479db75eb085f540263ba251a87c6acc7611ba6d40
|
||||
SHA512 (daemons-1.4.1.gem) = c057a7cbafc16f9daa073ce9fd5680f5f978826554073f4e77f2b284aee73567253d471224109d060193572f313e5eaa1509a2113a1564c1508969f658c045c5
|
||||
SHA512 (ethon-0.15.0.gem) = 6e04c70e105fb95f1e0ff62e1d6ae009bb7b39a60d85ec9e43b10c016f33f679620ded253089a738e0cef5010e9023d1093dd92b1caacdde8f6a745cbae2b5b5
|
||||
SHA512 (ffi-1.15.5.gem) = 074df34edffc7038ab08199350a97b32280d61ea15dd85d459b008bd3363ec5403b4e533621c8e460e5288f01fec944bff9b149851b819e85bab75ad2362227c
|
||||
SHA512 (ruby2_keywords-0.0.5.gem) = f6b9078b111e68c0017e0025ecdccb976c7a32f35c1a8adf9fd879db0c91f89eb9bd799f9527a846e28056f2a5fbf0f3610cda9538570288c493613c35c83a6f
|
||||
SHA512 (thin-1.8.1.gem) = c200ea03b7876b2a17b5875557fa967b8d01db20cc401811f314f3285f8249b8793e4709b7bc033a9c5813b9a51e3093c55f717b4a98b8fda171aa82813b7419
|
||||
@ -12,10 +11,11 @@ SHA512 (childprocess-4.1.0.gem) = e635c3acfa5ad85891c3879f240c7e96d47d7d5ec3f472
|
||||
SHA512 (mustermann-3.0.0.gem) = c33d41281fe2ac80c0af0c5c31dbab2068c73b9da19a4b82b387bbe551019fc115675634d932a8e56b070c3a06a85d830c982a103e6c5193aff8647f599be6e3
|
||||
SHA512 (tilt-2.0.11.gem) = 757a292b05b3ddb2cb8de7680f09433cec85b433e03cd9f738534b99c836fb2129870003a9376c24b6a2f6acb732b51b27968cc0e197a832130d4a35b8dc8239
|
||||
SHA512 (tornado-6.2.0.tar.gz) = b8f98b76198f21bb3a13f44e8698397d7906a415e75621550dfeea8ae3a7e9405f5e314136a93b6714455062501051c145dfd32c71b433715fc8ed591fcb882b
|
||||
SHA512 (sinatra-3.0.2.gem) = 16638592dcfa4a0968e46bc6c6ce71c817ccaae050fe3d3d05d3f7dfcff86596c2586a821ba0968ae16755fed07a1655d608a9cd6546d90a1c2991099ef5e488
|
||||
SHA512 (rack-protection-3.0.2.gem) = 54603e8ba22f1b359e5ffe82a3ee99a31a26e5dedd1e46edd4591ca416a1f241dc37ce2b6da25262a9cf9027b0e8687bd23c6dcbea0197131ca33088cbfd0280
|
||||
SHA512 (rack-test-2.0.2.gem) = 1d395d9504f8d84bcf0e251a9c5873eace29f274b177c7a6bfbdce58f6085ab5170f66d16086e3e159aaa47480d5f993c77b64d613cefda342932c39ad37331d
|
||||
SHA512 (pcs-web-ui-node-modules-0.1.16.tar.xz) = 2f94b49bdd7a01a01885cd2d48c5f8bc0338819a90851c404e951ea1aa343ab34f6dc0d4bf40a2cafd6c38bd766062f5577712b25761628e1772fae1e3a4c59f
|
||||
SHA512 (webrick-1.7.0.gem) = 5f242b50300046fe7c22ecd1640a73e5815e05a72bedfebe6bc39c24c92bd61abdd180860de0d194c0eebbc640b507b6892de181d3b577c5372ace0ca6faf2a3
|
||||
SHA512 (pcs-web-ui-0.1.16.tar.gz) = d0451df5fe8d1c3bd14df807f3eeae2e617c7498f52d3db67187553585fa019ba7fe7304e670f430943619f9bdca6b7c0f220d94c3b2423d8e75a1a374cde88c
|
||||
SHA512 (pcs-0.11.4.tar.gz) = df5b7caab7c218676c92db7d8cb24135b3cee1b0aa947851f08659222d7be501e205438e49695339fbad8b14b5637d9cf790e14c9ccc5151e188345924dc0153
|
||||
SHA512 (ethon-0.16.0.gem) = 3b31affcee0d5a5be05b5497d4a8d13515f8393f54579a3a9c8de49f78d3f065bb92659434b023f0a8bf8e0cccfbc94b617695b93c4d3f744cccd1eff2e68905
|
||||
SHA512 (rack-protection-3.0.4.gem) = b898c66dcac38219c43b1a6ce3a2952ca35e44f81b604f00dbff43938b5493df4c9a654ae221f01675f8f4b8aaf90f31b435a648f46f70789ac78a0c4a0c4f12
|
||||
SHA512 (sinatra-3.0.4.gem) = c0f5d7937cb0d513cafe8c87bccfc597088e93b005b85dd4e1f09f0eae1ef22ca1d6a4378a9d471c7115f91a8d91d8b843475a1fc5695e331013cd5f68b0cb18
|
||||
|
Loading…
Reference in New Issue
Block a user