Method: Puppet::Resource::Type#validate_resource

Defined in:
lib/puppet/resource/type.rb

#validate_resource(resource) ⇒ Object

Validate that all parameters given to the resource are correct

Parameters:



296
297
298
299
300
301
302
303
304
305
306
# File 'lib/puppet/resource/type.rb', line 296

def validate_resource(resource)
  # Since Sensitive values have special encoding (in a separate parameter) an unwrapped sensitive value must be
  # recreated as a Sensitive in order to perform correct type checking.
  sensitives = Set.new(resource.sensitive_parameters)
  validate_resource_hash(resource,
    Hash[resource.parameters.map do |name, value|
      value_to_validate = sensitives.include?(name) ? Puppet::Pops::Types::PSensitiveType::Sensitive.new(value.value) : value.value
      [name.to_s, value_to_validate]
    end
  ])
end