From f10ce89117192b3faa1e3b9f5200f9c13cacf39a Mon Sep 17 00:00:00 2001 From: Damien Ciabrini Date: Thu, 8 Jun 2023 12:52:40 +0200 Subject: [PATCH] Adapt providers to new pcs-0.11.5 output Pcs `constraint colocation show` output changed since https://github.com/ClusterLabs/pcs/commit/ff1d564830b3ab922249a796ecfc4a63925ec4c8 . pcs-0.11.4: Colocation Constraints: ip-172.31.0.1 with haproxy-bundle (score:INFINITY) ip-172.31.0.1 with galera-bundle (score:INFINITY) (rsc-role:Started) (with-rsc-role:Promoted) pcs-0.11.5: Colocation Constraints: resource 'ip-172.31.0.1' with resource 'haproxy-bundle' Started resource 'ip-172.31.0.1' with Promoted resource 'galera-bundle' Our helper functions need to be adapted to the new output. Change-Id: I4e916b20dedf8e40d2ffd032d8950fe16d1a7079 Co-authored-by: Luca Miccini Related-Bug: #2023019 --- lib/puppet/provider/pcmk_constraint/default.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet/provider/pcmk_constraint/default.rb b/lib/puppet/provider/pcmk_constraint/default.rb index b3ce8f95..08474e39 100644 --- a/lib/puppet/provider/pcmk_constraint/default.rb +++ b/lib/puppet/provider/pcmk_constraint/default.rb @@ -68,9 +68,9 @@ Puppet::Type.type(:pcmk_constraint).provide(:default) do if @resource[:master_slave] # pacemaker 2.1 started returning Promoted instead of Master # so we need to cater to both - return true if line.include? resource_resource + ' with ' + resource_location and (line.include? "with-rsc-role:Master" or line.include? "with-rsc-role:Promoted") + return true if line =~ /(resource )?'?#{resource_resource}'? with ((Promoted )?resource )?'?#{resource_location}'?/ and line =~ /(with-rsc-role:(Master|Promoted)|Promoted resource)/ else - return true if line.include? resource_resource + ' with ' + resource_location + return true if line =~ /(resource )?'?#{resource_resource}'? with (resource )?'?#{resource_location}'?/ end when :order return true if line.include? resource_name