Skip to content

Commit a1e2ada

Browse files
patchback[bot]munchtoastfelixfontein
authored
[PR #10663/b9385d7f backport][stable-11] pacemaker_resource: Fix resource_type parameter (#10699)
pacemaker_resource: Fix resource_type parameter (#10663) * Ensure resource standard, provider, and name are proper format * Add changelog fragment * Update changelogs/fragments/10663-pacemaker-resource-fix-resource-type.yml --------- (cherry picked from commit b9385d7) Co-authored-by: Dexter <[email protected]> Co-authored-by: Felix Fontein <[email protected]>
1 parent d7eb543 commit a1e2ada

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bugfixes:
2+
- "pacemaker_resource - fix ``resource_type`` parameter formatting (https://github.com/ansible-collections/community.general/issues/10426, https://github.com/ansible-collections/community.general/pull/10663)."

plugins/module_utils/pacemaker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525

2626
def fmt_resource_type(value):
27-
return [value[k] for k in ['resource_standard', 'resource_provider', 'resource_name'] if value.get(k) is not None]
27+
return [":".join(value[k] for k in ['resource_standard', 'resource_provider', 'resource_name'] if value.get(k) is not None)]
2828

2929

3030
def fmt_resource_operation(value):

tests/unit/plugins/modules/test_pacemaker_resource.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ test_cases:
5757
name: virtual-ip
5858
resource_type:
5959
resource_name: IPaddr2
60+
resource_standard: ocf
61+
resource_provider: heartbeat
6062
resource_option:
6163
- "ip=[192.168.2.1]"
6264
resource_operation:
@@ -98,10 +100,10 @@ test_cases:
98100
dc-version=2.1.9-1.fc41-7188dbf
99101
have-watchdog=false
100102
err: ""
101-
- command: [/testbin/pcs, resource, create, virtual-ip, IPaddr2, "ip=[192.168.2.1]", op, start, timeout=1200, op, stop, timeout=1200, op, monitor, timeout=1200, meta, test_meta1=123, meta, test_meta2=456, --group, test_group, --wait=200]
103+
- command: [/testbin/pcs, resource, create, virtual-ip, ocf:heartbeat:IPaddr2, "ip=[192.168.2.1]", op, start, timeout=1200, op, stop, timeout=1200, op, monitor, timeout=1200, meta, test_meta1=123, meta, test_meta2=456, --group, test_group, --wait=200]
102104
environ: *env-def
103105
rc: 0
104-
out: "Assumed agent name 'ocf:heartbeat:IPaddr2' (deduced from 'IPAddr2')"
106+
out: "Assumed agent name 'ocf:heartbeat:IPaddr2'"
105107
err: ""
106108
- command: [/testbin/pcs, resource, status, virtual-ip]
107109
environ: *env-def

0 commit comments

Comments
 (0)