Method: Puppet::Type.validate
- Defined in:
- lib/puppet/type.rb
.validate {|| ... } ⇒ void
This method returns an undefined value.
Creates a validate method that is used to validate a resource before it is operated on. The validation should raise exceptions if the validation finds errors. (It is not recommended to issue warnings as this typically just ends up in a logfile - you should fail if a validation fails). The easiest way to raise an appropriate exception is to call the method Util::Errors.fail with the message as an argument.
2251 2252 2253 2254 2255 2256 2257 2258 2259 |
# File 'lib/puppet/type.rb', line 2251 def self.validate(&block) define_method(:unsafe_validate, &block) define_method(:validate) do return if enum_for(:eachparameter).any? { |p| p.value.instance_of?(Puppet::Pops::Evaluator::DeferredValue) } unsafe_validate end end |