diff --git a/changelogs/fragments/10663-pacemaker-resource-fix-resource-type.yml b/changelogs/fragments/10663-pacemaker-resource-fix-resource-type.yml new file mode 100644 index 0000000000..270488d248 --- /dev/null +++ b/changelogs/fragments/10663-pacemaker-resource-fix-resource-type.yml @@ -0,0 +1,2 @@ +bugfixes: + - "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)." diff --git a/plugins/module_utils/pacemaker.py b/plugins/module_utils/pacemaker.py index 6228244e10..977a71806a 100644 --- a/plugins/module_utils/pacemaker.py +++ b/plugins/module_utils/pacemaker.py @@ -24,7 +24,7 @@ _state_map = { def fmt_resource_type(value): - return [value[k] for k in ['resource_standard', 'resource_provider', 'resource_name'] if value.get(k) is not None] + return [":".join(value[k] for k in ['resource_standard', 'resource_provider', 'resource_name'] if value.get(k) is not None)] def fmt_resource_operation(value): diff --git a/tests/unit/plugins/modules/test_pacemaker_resource.yaml b/tests/unit/plugins/modules/test_pacemaker_resource.yaml index 76679d14d9..5ecd1797e5 100644 --- a/tests/unit/plugins/modules/test_pacemaker_resource.yaml +++ b/tests/unit/plugins/modules/test_pacemaker_resource.yaml @@ -57,6 +57,8 @@ test_cases: name: virtual-ip resource_type: resource_name: IPaddr2 + resource_standard: ocf + resource_provider: heartbeat resource_option: - "ip=[192.168.2.1]" resource_operation: @@ -98,10 +100,10 @@ test_cases: dc-version=2.1.9-1.fc41-7188dbf have-watchdog=false err: "" - - 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] + - 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] environ: *env-def rc: 0 - out: "Assumed agent name 'ocf:heartbeat:IPaddr2' (deduced from 'IPAddr2')" + out: "Assumed agent name 'ocf:heartbeat:IPaddr2'" err: "" - command: [/testbin/pcs, resource, status, virtual-ip] environ: *env-def