Method: Puppet::Type#validate_resource

Defined in:
lib/puppet/type.rb

#validate_resourcevoid

This method returns an undefined value.

Optionally validate the resource. This method is a noop if the type has not defined a ‘validate` method using the puppet DSL. If validation fails, then an exception will be raised with this resources as the context.



2403
2404
2405
2406
2407
2408
2409
2410
2411
# File 'lib/puppet/type.rb', line 2403

def validate_resource
  begin
    self.validate if self.respond_to?(:validate)
  rescue Puppet::Error, ArgumentError => detail
    error = Puppet::ResourceError.new("Validation of #{ref} failed: #{detail}")
    adderrorcontext(error, detail)
    raise error
  end
end