diff options
author | Chris Price <chris@puppetlabs.com> | 2012-09-20 11:35:45 -0700 |
---|---|---|
committer | Chris Price <chris@puppetlabs.com> | 2012-09-20 11:35:45 -0700 |
commit | e527908b7c6ac5d91677229a96d5a97194dc68b7 (patch) | |
tree | 363d5bd285f3f03e113b08b1deae5eac45eb98da /lib/puppet/type | |
parent | 8d1fdc5c29d70027b0f1859145ced5ebb266cf9c (diff) | |
download | puppet-inifile-e527908b7c6ac5d91677229a96d5a97194dc68b7.tar.gz puppet-inifile-e527908b7c6ac5d91677229a96d5a97194dc68b7.tar.bz2 |
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.
Diffstat (limited to 'lib/puppet/type')
-rw-r--r-- | lib/puppet/type/ini_setting.rb | 6 |
1 files changed, 6 insertions, 0 deletions
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 |