From b5e07b7abf0ecfee80f05733f4c14d79a443ce8e Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Fri, 21 Mar 2014 17:11:11 +0000 Subject: [PATCH] correctly parse empty parameter values in CIB objects For a CIB object definition such as: primitive database-config-default-fs ocf:heartbeat:Filesystem \ params device="/dev/drbd/postgresql" directory="/var/lib/pgsql" fstype="" \ op monitor interval="10s" when #extract_hash attempts to extract the 'params' section, Shellwords.split will return an Array whose last element is fstype= not fstype="" as you might expect. Therefore we need to allow for an empty string to the right of the equals sign, otherwise parsing fails. --- libraries/pacemaker/resource.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/pacemaker/resource.rb b/libraries/pacemaker/resource.rb index c410e73..272d40a 100644 --- a/libraries/pacemaker/resource.rb +++ b/libraries/pacemaker/resource.rb @@ -45,7 +45,7 @@ module Pacemaker h = {} Shellwords.split($1).each do |kvpair| break if kvpair == 'op' - unless kvpair =~ /^(.+?)=(.+)$/ + unless kvpair =~ /^(.+?)=(.*)$/ raise "Couldn't understand '#{kvpair}' for '#{data_type}' section "\ "of #{name} primitive (definition was [#{obj_definition}])" end