9792d48c7b
- 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
146 lines
6.3 KiB
Diff
146 lines
6.3 KiB
Diff
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
|
|
|