From e527908b7c6ac5d91677229a96d5a97194dc68b7 Mon Sep 17 00:00:00 2001 From: Chris Price Date: Thu, 20 Sep 2012 11:35:45 -0700 Subject: Add validation for key_val_separator For now, the key_val_separator is required to contain exactly one '=' character. This commit simply validates that that is the case. --- lib/puppet/type/ini_setting.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/puppet') diff --git a/lib/puppet/type/ini_setting.rb b/lib/puppet/type/ini_setting.rb index f1ab490..50b6b38 100644 --- a/lib/puppet/type/ini_setting.rb +++ b/lib/puppet/type/ini_setting.rb @@ -35,6 +35,12 @@ Puppet::Type.newtype(:ini_setting) do 'Defaults to " = ", but you could use this to override e.g. whether ' + 'or not the separator should include whitespace.' defaultto(" = ") + + validate do |value| + unless value.scan('=').size == 1 + raise Puppet::Error, ":key_val_separator must contain exactly one = character." + end + end end end -- cgit v1.2.3