import pcs-0.10.15-2.el8
This commit is contained in:
parent
688acbe96c
commit
ee54cc0896
8
.gitignore
vendored
8
.gitignore
vendored
@ -3,10 +3,10 @@ SOURCES/backports-3.23.0.gem
|
|||||||
SOURCES/dacite-1.6.0.tar.gz
|
SOURCES/dacite-1.6.0.tar.gz
|
||||||
SOURCES/daemons-1.4.1.gem
|
SOURCES/daemons-1.4.1.gem
|
||||||
SOURCES/dataclasses-0.8.tar.gz
|
SOURCES/dataclasses-0.8.tar.gz
|
||||||
SOURCES/ethon-0.15.0.gem
|
SOURCES/ethon-0.16.0.gem
|
||||||
SOURCES/eventmachine-1.2.7.gem
|
SOURCES/eventmachine-1.2.7.gem
|
||||||
SOURCES/ffi-1.15.5.gem
|
SOURCES/ffi-1.15.5.gem
|
||||||
SOURCES/json-2.6.2.gem
|
SOURCES/json-2.6.3.gem
|
||||||
SOURCES/mustermann-2.0.2.gem
|
SOURCES/mustermann-2.0.2.gem
|
||||||
SOURCES/open4-1.3.4-1.gem
|
SOURCES/open4-1.3.4-1.gem
|
||||||
SOURCES/pcs-0.10.15.tar.gz
|
SOURCES/pcs-0.10.15.tar.gz
|
||||||
@ -15,11 +15,11 @@ SOURCES/pcs-web-ui-node-modules-0.1.13.tar.xz
|
|||||||
SOURCES/pyagentx-0.4.pcs.2.tar.gz
|
SOURCES/pyagentx-0.4.pcs.2.tar.gz
|
||||||
SOURCES/python-dateutil-2.8.2.tar.gz
|
SOURCES/python-dateutil-2.8.2.tar.gz
|
||||||
SOURCES/rack-2.2.4.gem
|
SOURCES/rack-2.2.4.gem
|
||||||
SOURCES/rack-protection-2.2.2.gem
|
SOURCES/rack-protection-2.2.3.gem
|
||||||
SOURCES/rack-test-2.0.2.gem
|
SOURCES/rack-test-2.0.2.gem
|
||||||
SOURCES/rexml-3.2.5.gem
|
SOURCES/rexml-3.2.5.gem
|
||||||
SOURCES/ruby2_keywords-0.0.5.gem
|
SOURCES/ruby2_keywords-0.0.5.gem
|
||||||
SOURCES/sinatra-2.2.2.gem
|
SOURCES/sinatra-2.2.3.gem
|
||||||
SOURCES/thin-1.8.1.gem
|
SOURCES/thin-1.8.1.gem
|
||||||
SOURCES/tilt-2.0.11.gem
|
SOURCES/tilt-2.0.11.gem
|
||||||
SOURCES/tornado-6.1.0.tar.gz
|
SOURCES/tornado-6.1.0.tar.gz
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
31546c37fbdc6270d5097687619e9c0db6f1c05c SOURCES/dacite-1.6.0.tar.gz
|
31546c37fbdc6270d5097687619e9c0db6f1c05c SOURCES/dacite-1.6.0.tar.gz
|
||||||
4795a8962cc1608bfec0d91fa4d438c7cfe90c62 SOURCES/daemons-1.4.1.gem
|
4795a8962cc1608bfec0d91fa4d438c7cfe90c62 SOURCES/daemons-1.4.1.gem
|
||||||
8b7598273d2ae6dad2b88466aefac55071a41926 SOURCES/dataclasses-0.8.tar.gz
|
8b7598273d2ae6dad2b88466aefac55071a41926 SOURCES/dataclasses-0.8.tar.gz
|
||||||
29697a34b8cd9df4a77c650e2a38d0a36cdeee8b SOURCES/ethon-0.15.0.gem
|
5b56a68268708c474bef04550639ded3add5e946 SOURCES/ethon-0.16.0.gem
|
||||||
7a5b2896e210fac9759c786ee4510f265f75b481 SOURCES/eventmachine-1.2.7.gem
|
7a5b2896e210fac9759c786ee4510f265f75b481 SOURCES/eventmachine-1.2.7.gem
|
||||||
97632b7975067266c0b39596de0a4c86d9330658 SOURCES/ffi-1.15.5.gem
|
97632b7975067266c0b39596de0a4c86d9330658 SOURCES/ffi-1.15.5.gem
|
||||||
86c10824191e8f351da3fe0a0b6db94a813ada3a SOURCES/json-2.6.2.gem
|
6d78f730b7f3b25fb3f93684fe1364acf58bce6b SOURCES/json-2.6.3.gem
|
||||||
f5f804366823c1126791dfefd98dd0539563785c SOURCES/mustermann-2.0.2.gem
|
f5f804366823c1126791dfefd98dd0539563785c SOURCES/mustermann-2.0.2.gem
|
||||||
41a7fe9f8e3e02da5ae76c821b89c5b376a97746 SOURCES/open4-1.3.4-1.gem
|
41a7fe9f8e3e02da5ae76c821b89c5b376a97746 SOURCES/open4-1.3.4-1.gem
|
||||||
00e234824e85afca99df9043dd6eb47490b220c4 SOURCES/pcs-0.10.15.tar.gz
|
00e234824e85afca99df9043dd6eb47490b220c4 SOURCES/pcs-0.10.15.tar.gz
|
||||||
@ -15,11 +15,11 @@ bd18d97d611233914828719c97b4d98d079913d2 SOURCES/pcs-web-ui-node-modules-0.1.13.
|
|||||||
3176b2f2b332c2b6bf79fe882e83feecf3d3f011 SOURCES/pyagentx-0.4.pcs.2.tar.gz
|
3176b2f2b332c2b6bf79fe882e83feecf3d3f011 SOURCES/pyagentx-0.4.pcs.2.tar.gz
|
||||||
c2ba10c775b7a52a4b57cac4d4110a0c0f812a82 SOURCES/python-dateutil-2.8.2.tar.gz
|
c2ba10c775b7a52a4b57cac4d4110a0c0f812a82 SOURCES/python-dateutil-2.8.2.tar.gz
|
||||||
d884e586767313f8fcf8c863b5220831a95fccb8 SOURCES/rack-2.2.4.gem
|
d884e586767313f8fcf8c863b5220831a95fccb8 SOURCES/rack-2.2.4.gem
|
||||||
4bebd27a0af0a30dbeba4c5a1b82e05f3418f6be SOURCES/rack-protection-2.2.2.gem
|
312014942846897a363990784c3be291e66d38a2 SOURCES/rack-protection-2.2.3.gem
|
||||||
3c669527ecbcb9f915a83983ec89320c356e1fe3 SOURCES/rack-test-2.0.2.gem
|
3c669527ecbcb9f915a83983ec89320c356e1fe3 SOURCES/rack-test-2.0.2.gem
|
||||||
e7f48fa5fb2d92e6cb21d6b1638fe41a5a7c4287 SOURCES/rexml-3.2.5.gem
|
e7f48fa5fb2d92e6cb21d6b1638fe41a5a7c4287 SOURCES/rexml-3.2.5.gem
|
||||||
d017b9e4d1978e0b3ccc3e2a31493809e4693cd3 SOURCES/ruby2_keywords-0.0.5.gem
|
d017b9e4d1978e0b3ccc3e2a31493809e4693cd3 SOURCES/ruby2_keywords-0.0.5.gem
|
||||||
f4603e0742a3849cc9caf2d83f1112a91076bbbb SOURCES/sinatra-2.2.2.gem
|
5bf6cbdabd03404a654e639b4e949705473c1050 SOURCES/sinatra-2.2.3.gem
|
||||||
1ac6292a98e17247b7bb847a35ff868605256f7b SOURCES/thin-1.8.1.gem
|
1ac6292a98e17247b7bb847a35ff868605256f7b SOURCES/thin-1.8.1.gem
|
||||||
360d77c80d2851a538fb13d43751093115c34712 SOURCES/tilt-2.0.11.gem
|
360d77c80d2851a538fb13d43751093115c34712 SOURCES/tilt-2.0.11.gem
|
||||||
c23c617c7a0205e465bebad5b8cdf289ae8402a2 SOURCES/tornado-6.1.0.tar.gz
|
c23c617c7a0205e465bebad5b8cdf289ae8402a2 SOURCES/tornado-6.1.0.tar.gz
|
||||||
|
@ -0,0 +1,146 @@
|
|||||||
|
From 2a3747fedeae228345c4ee74ce8ad6d72e297525 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ondrej Mular <omular@redhat.com>
|
||||||
|
Date: Wed, 7 Dec 2022 15:53:25 +0100
|
||||||
|
Subject: [PATCH 2/2] fix displaying bool and integer values in `pcs resource
|
||||||
|
config` command
|
||||||
|
|
||||||
|
---
|
||||||
|
CHANGELOG.md | 6 ++++++
|
||||||
|
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, 20 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
|
||||||
|
index 75d50acd..b4d64578 100644
|
||||||
|
--- a/CHANGELOG.md
|
||||||
|
+++ b/CHANGELOG.md
|
||||||
|
@@ -7,6 +7,12 @@
|
||||||
|
self-validation feature when the resource is already misconfigured
|
||||||
|
([rhbz#2151511])
|
||||||
|
|
||||||
|
+### Fixed
|
||||||
|
+- Displaying bool and integer values in `pcs resource config` command
|
||||||
|
+ ([rhbz#2151166], [ghissue#604])
|
||||||
|
+
|
||||||
|
+[ghissue#604]: https://github.com/ClusterLabs/pcs/issues/604
|
||||||
|
+[rhbz#2151166]: https://bugzilla.redhat.com/show_bug.cgi?id=2151166
|
||||||
|
[rhbz#2151511]: https://bugzilla.redhat.com/show_bug.cgi?id=2151511
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/pcs/cli/resource/output.py b/pcs/cli/resource/output.py
|
||||||
|
index 6d1fad16..0705d27b 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))
|
||||||
|
)
|
||||||
|
@@ -477,13 +477,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))
|
||||||
|
@@ -508,7 +508,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))
|
||||||
|
)
|
||||||
|
@@ -516,7 +516,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))
|
||||||
|
)
|
||||||
|
@@ -531,9 +531,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 67cf5178..524b8fbb 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 2ea5c423..65ad1090 100644
|
||||||
|
--- a/pcs_test/tier1/legacy/test_resource.py
|
||||||
|
+++ b/pcs_test/tier1/legacy/test_resource.py
|
||||||
|
@@ -753,7 +753,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
|
||||||
|
@@ -770,6 +770,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 8f46f6dd..a980ec80 100644
|
||||||
|
--- a/pcs_test/tools/resources_dto.py
|
||||||
|
+++ b/pcs_test/tools/resources_dto.py
|
||||||
|
@@ -233,8 +233,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,753 @@
|
|||||||
|
From fc2cc9c30dbe3559b4989acda32f8a8613ee5c16 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ondrej Mular <omular@redhat.com>
|
||||||
|
Date: Wed, 7 Dec 2022 11:33:25 +0100
|
||||||
|
Subject: [PATCH 1/2] add warning when updating a misconfigured resource
|
||||||
|
|
||||||
|
---
|
||||||
|
CHANGELOG.md | 10 +++
|
||||||
|
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, 171 insertions(+), 138 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
|
||||||
|
index 2af6bee1..75d50acd 100644
|
||||||
|
--- a/CHANGELOG.md
|
||||||
|
+++ b/CHANGELOG.md
|
||||||
|
@@ -1,5 +1,15 @@
|
||||||
|
# Change Log
|
||||||
|
|
||||||
|
+## [Unreleased]
|
||||||
|
+
|
||||||
|
+### Added
|
||||||
|
+- Warning to `pcs resource|stonith update` commands about not using agent
|
||||||
|
+ self-validation feature when the resource is already misconfigured
|
||||||
|
+ ([rhbz#2151511])
|
||||||
|
+
|
||||||
|
+[rhbz#2151511]: https://bugzilla.redhat.com/show_bug.cgi?id=2151511
|
||||||
|
+
|
||||||
|
+
|
||||||
|
## [0.10.15] - 2022-11-23
|
||||||
|
|
||||||
|
### Security
|
||||||
|
diff --git a/pcs/common/reports/codes.py b/pcs/common/reports/codes.py
|
||||||
|
index deecc626..48048af7 100644
|
||||||
|
--- a/pcs/common/reports/codes.py
|
||||||
|
+++ b/pcs/common/reports/codes.py
|
||||||
|
@@ -40,6 +40,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 d27c1dee..24bb222f 100644
|
||||||
|
--- a/pcs/common/reports/messages.py
|
||||||
|
+++ b/pcs/common/reports/messages.py
|
||||||
|
@@ -7584,6 +7584,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 BoothAuthfileNotUsed(ReportItemMessage):
|
||||||
|
"""
|
||||||
|
diff --git a/pcs/lib/cib/resource/primitive.py b/pcs/lib/cib/resource/primitive.py
|
||||||
|
index 3ebd01c6..c5df8e58 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,
|
||||||
|
@@ -402,16 +427,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
|
||||||
|
|
||||||
|
|
||||||
|
@@ -505,25 +530,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 fd26dabb..726f6b67 100644
|
||||||
|
--- a/pcs/lib/pacemaker/live.py
|
||||||
|
+++ b/pcs/lib/pacemaker/live.py
|
||||||
|
@@ -902,8 +902,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",
|
||||||
|
@@ -917,7 +916,6 @@ def _validate_stonith_instance_attributes_via_pcmk(
|
||||||
|
cmd,
|
||||||
|
"./validate/command/output",
|
||||||
|
instance_attributes,
|
||||||
|
- not_valid_severity,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -925,8 +923,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",
|
||||||
|
@@ -944,7 +941,6 @@ def _validate_resource_instance_attributes_via_pcmk(
|
||||||
|
cmd,
|
||||||
|
"./resource-agent-action/command/output",
|
||||||
|
instance_attributes,
|
||||||
|
- not_valid_severity,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -953,8 +949,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}"])
|
||||||
|
@@ -963,12 +958,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()
|
||||||
|
@@ -976,38 +966,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 17627b80..5fcc62fc 100644
|
||||||
|
--- a/pcs_test/tier0/common/reports/test_messages.py
|
||||||
|
+++ b/pcs_test/tier0/common/reports/test_messages.py
|
||||||
|
@@ -5562,6 +5562,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 BoothAuthfileNotUsed(NameBuildTest):
|
||||||
|
def test_message(self):
|
||||||
|
self.assert_message_from_report(
|
||||||
|
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 2cba7086..1bc3a5a6 100644
|
||||||
|
--- a/pcs_test/tier0/lib/cib/resource/test_primitive_validate.py
|
||||||
|
+++ b/pcs_test/tier0/lib/cib/resource/test_primitive_validate.py
|
||||||
|
@@ -609,7 +609,6 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
|
||||||
|
self.cmd_runner,
|
||||||
|
facade.metadata.name,
|
||||||
|
attributes,
|
||||||
|
- reports.ReportItemSeverity.error(reports.codes.FORCE),
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_force(self):
|
||||||
|
@@ -629,15 +628,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,
|
||||||
|
@@ -645,13 +643,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):
|
||||||
|
@@ -671,7 +674,6 @@ class ValidateResourceInstanceAttributesCreateSelfValidation(TestCase):
|
||||||
|
self.cmd_runner,
|
||||||
|
facade.metadata.name,
|
||||||
|
attributes,
|
||||||
|
- reports.ReportItemSeverity.error(reports.codes.FORCE),
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_nonexisting_agent(self):
|
||||||
|
@@ -1295,13 +1297,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),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
@@ -1328,13 +1328,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(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
@@ -1342,13 +1340,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,
|
||||||
|
@@ -1357,7 +1355,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,
|
||||||
|
@@ -1366,13 +1370,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),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
@@ -1399,13 +1401,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),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
@@ -1471,10 +1471,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,
|
||||||
|
@@ -1483,7 +1483,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,
|
||||||
|
@@ -1492,7 +1497,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 5c8000cd..239a72b1 100644
|
||||||
|
--- a/pcs_test/tier0/lib/pacemaker/test_live.py
|
||||||
|
+++ b/pcs_test/tier0/lib/pacemaker/test_live.py
|
||||||
|
@@ -1752,16 +1752,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"]
|
||||||
|
)
|
||||||
|
@@ -1771,23 +1770,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"]
|
||||||
|
@@ -1806,19 +1799,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"]
|
||||||
|
)
|
||||||
|
@@ -1837,23 +1826,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"]
|
||||||
|
)
|
||||||
|
@@ -1881,23 +1862,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"]
|
||||||
|
@@ -1925,23 +1900,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"]
|
||||||
|
@@ -1953,7 +1922,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"
|
||||||
|
)
|
||||||
|
@@ -1967,7 +1935,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,
|
||||||
|
)
|
||||||
|
@@ -1987,7 +1955,6 @@ class ValidateResourceInstanceAttributesViaPcmkTest(TestCase):
|
||||||
|
],
|
||||||
|
"./resource-agent-action/command/output",
|
||||||
|
self.attrs,
|
||||||
|
- self.severity,
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_without_provider(self):
|
||||||
|
@@ -1996,7 +1963,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,
|
||||||
|
)
|
||||||
|
@@ -2014,7 +1981,6 @@ class ValidateResourceInstanceAttributesViaPcmkTest(TestCase):
|
||||||
|
],
|
||||||
|
"./resource-agent-action/command/output",
|
||||||
|
self.attrs,
|
||||||
|
- self.severity,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2024,7 +1990,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"
|
||||||
|
)
|
||||||
|
@@ -2038,7 +2003,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,
|
||||||
|
)
|
||||||
|
@@ -2054,5 +2019,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 9911d604..cf430d75 100644
|
||||||
|
--- a/pcs_test/tier1/legacy/test_stonith.py
|
||||||
|
+++ b/pcs_test/tier1/legacy/test_stonith.py
|
||||||
|
@@ -1294,7 +1294,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
|
||||||
|
|
40
SOURCES/pcsd-rubygem-json-error-message-change.patch
Normal file
40
SOURCES/pcsd-rubygem-json-error-message-change.patch
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
From 38333342cb0e931b11bbf57ba469b47172221a32 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mamoru TASAKA <mtasaka@fedoraproject.org>
|
||||||
|
Date: Thu, 8 Dec 2022 22:47:59 +0900
|
||||||
|
Subject: [PATCH] pcsd ruby: adjust to json 2.6.3 error message change
|
||||||
|
|
||||||
|
json 2.6.3 now removes line number information from parser
|
||||||
|
error message.
|
||||||
|
Adjust regex pattern on pcs test code for ruby to support
|
||||||
|
this error format.
|
||||||
|
|
||||||
|
Fixes #606 .
|
||||||
|
---
|
||||||
|
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 7aaf4349..a580b24f 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.38.1
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
Name: pcs
|
Name: pcs
|
||||||
Version: 0.10.15
|
Version: 0.10.15
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
# https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/
|
# https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/
|
||||||
# https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses
|
# https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses
|
||||||
# GPL-2.0-only: pcs
|
# GPL-2.0-only: pcs
|
||||||
@ -9,10 +9,10 @@ Release: 1%{?dist}
|
|||||||
# MIT: backports, dacite, daemons, ember, ethon, handlebars, jquery, jquery-ui,
|
# MIT: backports, dacite, daemons, ember, ethon, handlebars, jquery, jquery-ui,
|
||||||
# mustermann, rack, rack-protection, rack-test, sinatra, tilt
|
# mustermann, rack, rack-protection, rack-test, sinatra, tilt
|
||||||
# GPL-2.0-only or Ruby: eventmachine, json
|
# GPL-2.0-only or Ruby: eventmachine, json
|
||||||
# (GPL-2.0-only or Ruby) and BSD: thin
|
# (GPL-2.0-only or Ruby) and BSD-2-Clause: thin
|
||||||
# BSD-2-Clause or Ruby: open4, ruby2_keywords
|
# BSD-2-Clause or Ruby: open4, ruby2_keywords
|
||||||
# BSD-3-Clause and MIT: ffi
|
# 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) AND (Apache-2.0 OR BSD-3-Clause)
|
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) AND BSD-2-Clause AND (Apache-2.0 OR BSD-3-Clause)
|
||||||
URL: https://github.com/ClusterLabs/pcs
|
URL: https://github.com/ClusterLabs/pcs
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
Summary: Pacemaker Configuration System
|
Summary: Pacemaker Configuration System
|
||||||
@ -37,18 +37,18 @@ ExclusiveArch: i686 x86_64 s390x ppc64le aarch64
|
|||||||
%global dateutil_version 2.8.2
|
%global dateutil_version 2.8.2
|
||||||
%global version_rubygem_backports 3.23.0
|
%global version_rubygem_backports 3.23.0
|
||||||
%global version_rubygem_daemons 1.4.1
|
%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_eventmachine 1.2.7
|
||||||
%global version_rubygem_ffi 1.15.5
|
%global version_rubygem_ffi 1.15.5
|
||||||
%global version_rubygem_json 2.6.2
|
%global version_rubygem_json 2.6.3
|
||||||
%global version_rubygem_mustermann 2.0.2
|
%global version_rubygem_mustermann 2.0.2
|
||||||
%global version_rubygem_open4 1.3.4
|
%global version_rubygem_open4 1.3.4
|
||||||
%global version_rubygem_rack 2.2.4
|
%global version_rubygem_rack 2.2.4
|
||||||
%global version_rubygem_rack_protection 2.2.2
|
%global version_rubygem_rack_protection 2.2.3
|
||||||
%global version_rubygem_rack_test 2.0.2
|
%global version_rubygem_rack_test 2.0.2
|
||||||
%global version_rubygem_rexml 3.2.5
|
%global version_rubygem_rexml 3.2.5
|
||||||
%global version_rubygem_ruby2_keywords 0.0.5
|
%global version_rubygem_ruby2_keywords 0.0.5
|
||||||
%global version_rubygem_sinatra 2.2.2
|
%global version_rubygem_sinatra 2.2.3
|
||||||
%global version_rubygem_thin 1.8.1
|
%global version_rubygem_thin 1.8.1
|
||||||
%global version_rubygem_tilt 2.0.11
|
%global version_rubygem_tilt 2.0.11
|
||||||
|
|
||||||
@ -122,6 +122,9 @@ Source101: https://github.com/ClusterLabs/pcs-web-ui/releases/download/%{ui_modu
|
|||||||
# pcs patches: <= 200
|
# pcs patches: <= 200
|
||||||
# Patch1: bzNUMBER-01-name.patch
|
# Patch1: bzNUMBER-01-name.patch
|
||||||
Patch1: do-not-support-cluster-setup-with-udp-u-transport.patch
|
Patch1: do-not-support-cluster-setup-with-udp-u-transport.patch
|
||||||
|
Patch2: bz2151511-01-add-warning-when-updating-a-misconfigured-resource.patch
|
||||||
|
Patch3: bz2151166-01-fix-displaying-bool-and-integer-values.patch
|
||||||
|
Patch4: pcsd-rubygem-json-error-message-change.patch
|
||||||
|
|
||||||
# Downstream patches do not come from upstream. They adapt pcs for specific
|
# Downstream patches do not come from upstream. They adapt pcs for specific
|
||||||
# RHEL needs.
|
# RHEL needs.
|
||||||
@ -321,6 +324,10 @@ update_times_patch(){
|
|||||||
%autopatch -p1 -M 200
|
%autopatch -p1 -M 200
|
||||||
|
|
||||||
update_times_patch %{PATCH1}
|
update_times_patch %{PATCH1}
|
||||||
|
update_times_patch %{PATCH2}
|
||||||
|
update_times_patch %{PATCH3}
|
||||||
|
update_times_patch %{PATCH4}
|
||||||
|
|
||||||
# update_times_patch %{PATCH101}
|
# update_times_patch %{PATCH101}
|
||||||
|
|
||||||
cp -f %SOURCE1 %{pcsd_public_dir}/images
|
cp -f %SOURCE1 %{pcsd_public_dir}/images
|
||||||
@ -473,7 +480,7 @@ run_all_tests
|
|||||||
remove_all_tests
|
remove_all_tests
|
||||||
|
|
||||||
%posttrans
|
%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
|
# Also, make sure to start pcsd-ruby if it hasn't been started or even
|
||||||
# installed before. This is done by restarting pcsd.service.
|
# installed before. This is done by restarting pcsd.service.
|
||||||
%{_bindir}/systemctl daemon-reload
|
%{_bindir}/systemctl daemon-reload
|
||||||
@ -570,6 +577,12 @@ remove_all_tests
|
|||||||
%license pyagentx_LICENSE.txt
|
%license pyagentx_LICENSE.txt
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Dec 16 2022 Michal Pospisil <mpospisi@redhat.com> - 0.10.15-2
|
||||||
|
- Added warning when omitting validation of misconfigured resource
|
||||||
|
- Fixed displaying of bool and integer values in `pcs resource config` command
|
||||||
|
- Updated bundled rubygems: ethon, json, rack-protection, sinatra
|
||||||
|
- Resolves: rhbz#2151166 rhbz#2151511
|
||||||
|
|
||||||
* Wed Nov 23 2022 Michal Pospisil <mpospisi@redhat.com> - 0.10.15-1
|
* Wed Nov 23 2022 Michal Pospisil <mpospisi@redhat.com> - 0.10.15-1
|
||||||
- Rebased to latest upstream sources (see CHANGELOG.md)
|
- Rebased to latest upstream sources (see CHANGELOG.md)
|
||||||
- Updated Python bundled dependency dateutil
|
- Updated Python bundled dependency dateutil
|
||||||
|
Loading…
Reference in New Issue
Block a user