[PR #10413/3b09e9d9 backport][stable-11] pacemaker_resource: add cleanup state (#10750)

pacemaker_resource: add cleanup state (#10413)

* refactor(deprecate): Add cleanup deprecations for pacemaker_cluster

* Additional code review changes

* Add changelog fragment

(cherry picked from commit 3b09e9d9ed)

Co-authored-by: Dexter <45038532+munchtoast@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2025-08-27 22:09:33 +02:00 committed by GitHub
commit 22946365fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 95 additions and 6 deletions

View file

@ -11,7 +11,7 @@ test_cases:
input: {}
output:
failed: true
msg: "missing required arguments: name"
msg: "state is present but all of the following are missing: resource_type, name"
- id: test_present_minimal_input_resource_not_exist
input:
state: present
@ -423,3 +423,76 @@ test_cases:
rc: 0
out: " * virtual-ip\t(ocf:heartbeat:IPAddr2):\t Stopped (disabled)"
err: ""
- id: test_cleanup_minimal_input_initial_resources_not_exist
input:
state: cleanup
output:
changed: false
previous_value: "NO resources configured"
value: "NO resources configured"
mocks:
run_command:
- command: [/testbin/pcs, resource, status]
environ: *env-def
rc: 0
out: "NO resources configured"
err: ""
- command: [/testbin/pcs, resource, cleanup]
environ: *env-def
rc: 0
out: "Cleaned up all resources on all nodes"
err: ""
- command: [/testbin/pcs, resource, status]
environ: *env-def
rc: 0
out: "NO resources configured"
err: ""
- id: test_cleanup_minimal_input_initial_resources_exists
input:
state: cleanup
output:
changed: true
previous_value: " * virtual-ip\t(ocf:heartbeat:IPAddr2):\t Started"
value: "NO resources configured"
mocks:
run_command:
- command: [/testbin/pcs, resource, status]
environ: *env-def
rc: 0
out: " * virtual-ip\t(ocf:heartbeat:IPAddr2):\t Started"
err: ""
- command: [/testbin/pcs, resource, cleanup]
environ: *env-def
rc: 0
out: "Cleaned up all resources on all nodes"
err: ""
- command: [/testbin/pcs, resource, status]
environ: *env-def
rc: 0
out: "NO resources configured"
err: ""
- id: test_cleanup_specific_minimal_input_initial_resources_exists
input:
state: cleanup
name: virtual-ip
output:
changed: true
previous_value: " * virtual-ip\t(ocf:heartbeat:IPAddr2):\t Started"
value: "NO resources configured"
mocks:
run_command:
- command: [/testbin/pcs, resource, status, virtual-ip]
environ: *env-def
rc: 0
out: " * virtual-ip\t(ocf:heartbeat:IPAddr2):\t Started"
err: ""
- command: [/testbin/pcs, resource, cleanup, virtual-ip]
environ: *env-def
rc: 0
out: "Cleaned up virtual-ip on X"
err: ""
- command: [/testbin/pcs, resource, status, virtual-ip]
environ: *env-def
rc: 0
out: "NO resources configured"
err: ""