[PR #10707/63321754 backport][stable-11] pacemaker: Add regex checking for maintenance-mode (#10749)

pacemaker: Add regex checking for maintenance-mode (#10707)

* Add regex checking for maintenance-mode

* Add changelog fragment

* Apply suggestions from code review




---------



(cherry picked from commit 6332175493)

Co-authored-by: Dexter <45038532+munchtoast@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2025-08-27 22:09:23 +02:00 committed by GitHub
commit ddc546596e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 70 additions and 2 deletions

View file

@ -371,6 +371,30 @@ test_cases:
rc: 0
out: 'maintenance-mode=true'
err: ""
- id: test_maintenance_minimal_input_initial_online_version_change
input:
state: maintenance
output:
changed: true
previous_value: 'maintenance-mode: false'
value: 'maintenance-mode: true'
mocks:
run_command:
- command: [/testbin/pcs, property, config, maintenance-mode]
environ: *env-def
rc: 0
out: 'maintenance-mode: false'
err: ""
- command: [/testbin/pcs, property, set, maintenance-mode=true]
environ: *env-def
rc: 0
out: ""
err: ""
- command: [/testbin/pcs, property, config, maintenance-mode]
environ: *env-def
rc: 0
out: 'maintenance-mode: true'
err: ""
- id: test_maintenance_minimal_input_initial_offline
input:
state: maintenance

View file

@ -189,6 +189,46 @@ test_cases:
rc: 0
out: " * virtual-ip\t(ocf:heartbeat:IPAddr2):\t Stopped"
err: ""
- id: test_present_minimal_input_resource_maintenance_mode_version_change
input:
state: present
name: virtual-ip
resource_type:
resource_name: IPaddr2
resource_option:
- "ip=[192.168.2.1]"
output:
changed: true
previous_value: null
value: " * virtual-ip\t(ocf:heartbeat:IPAddr2):\t Stopped"
mocks:
run_command:
- command: [/testbin/pcs, resource, status, virtual-ip]
environ: *env-def
rc: 1
out: ""
err: ""
- command: [/testbin/pcs, property, config]
environ: *env-def
rc: 0
out: |
Cluster Properties: cib-bootstrap-options
cluster-infrastructure: corosync
cluster-name: hacluster
dc-version: 2.1.9-1.fc41-7188dbf
have-watchdog: false
maintenance-mode: true
err: ""
- command: [/testbin/pcs, resource, create, virtual-ip, IPaddr2, "ip=[192.168.2.1]", --wait=300]
environ: *env-def
rc: 1
out: ""
err: "Error: resource 'virtual-ip' is not running on any node"
- command: [/testbin/pcs, resource, status, virtual-ip]
environ: *env-def
rc: 0
out: " * virtual-ip\t(ocf:heartbeat:IPAddr2):\t Stopped"
err: ""
- id: test_absent_minimal_input_resource_not_exist
input:
state: absent