diff options
| author | Luke Kanies <luke@reductivelabs.com> | 2010-01-22 00:48:37 -0800 |
|---|---|---|
| committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
| commit | 2fa0a489e26fc2512783c67b1b4579a03f8a20a6 (patch) | |
| tree | 0c0157fe3e854fc5fbfa1bd94fc47c528dffef27 /lib/puppet/resource | |
| parent | aff59926bb8c8e7a136d6e87359e9857a4512da9 (diff) | |
| download | puppet-2fa0a489e26fc2512783c67b1b4579a03f8a20a6.tar.gz puppet-2fa0a489e26fc2512783c67b1b4579a03f8a20a6.tar.xz puppet-2fa0a489e26fc2512783c67b1b4579a03f8a20a6.zip | |
Adding parameter validation to Puppet::Resource
This will allow us to remove all of the parameter
validation from the other Resource classes.
This is possible because resource types defined
in the language are visible outside of the parser,
via the environment.
This will enable lots of code removal and simplication.
Signed-off-by: Luke Kanies <luke@reductivelabs.com>
Diffstat (limited to 'lib/puppet/resource')
| -rw-r--r-- | lib/puppet/resource/type.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/puppet/resource/type.rb b/lib/puppet/resource/type.rb index 9baf1983e..d47658284 100644 --- a/lib/puppet/resource/type.rb +++ b/lib/puppet/resource/type.rb @@ -144,7 +144,7 @@ class Puppet::Resource::Type set = {} resource.to_hash.each do |param, value| param = param.to_sym - fail Puppet::ParseError, "#{resource.ref} does not accept attribute #{param}" unless validattr?(param) + fail Puppet::ParseError, "#{resource.ref} does not accept attribute #{param}" unless valid_parameter?(param) exceptwrap { scope.setvar(param.to_s, value) } @@ -174,7 +174,7 @@ class Puppet::Resource::Type end # Check whether a given argument is valid. - def validattr?(param) + def valid_parameter?(param) param = param.to_s return true if param == "name" |
