lib/puppet/resource.rb
# Verify that all required arguments are either present or
# have been provided with defaults.
# Must be called after 'set_default_parameters'.  We can't join the methods
# because Type#set_parameters needs specifically ordered behavior.
#
# @deprecated Not used by Puppet
# @api private
Verify that all required arguments are either present or
have been provided with defaults.
Must be called after 'set_default_parameters'.  We can't join the methods
because Type#set_parameters needs specifically ordered behavior.
Verify that all required arguments are either present or have been provided with defaults . Must be called after ' set_default_parameters ' . We can ' t join the methods because Type#set_parameters needs specifically ordered behavior .
def validate_complete
    Puppet.deprecation_warning(_('The method Puppet::Resource.validate_complete is deprecated and will be removed in the next major release of Puppet.'))
    return unless resource_type and resource_type.respond_to?(:arguments)
    resource_type.arguments.each do |param, default|
      param = param.to_sym
      fail Puppet::ParseError, _("Must pass %{param} to %{resource}") % { param: param, resource: self } unless parameters.include?(param)
    end
    arg_types = resource_type.argument_types
    parameters.each do |name, value|
      next unless t = arg_types[name.to_s]  
      unless Puppet::Pops::Types::TypeCalculator.instance?(t, value.value)
        inferred_type = Puppet::Pops::Types::TypeCalculator.infer_set(value.value)
        actual = inferred_type.generalize()
        fail Puppet::ParseError, _("Expected parameter '%{name}' of '%{value0}' to have type %{value1}, got %{value2}") % { name: name, value0: self, value1: t.to_s, value2: actual.to_s }
      end
    end
  end
def validate_complete Puppet . deprecation_warning ( _ ( 'The method Puppet::Resource.validate_complete is deprecated and will be removed in the next major release of Puppet.' ) ) return unless resource_type and resource_type . respond_to? ( :arguments ) resource_type . arguments . each do | param , default | param = param . to_sym fail Puppet :: ParseError , _ ( "Must pass %{param} to %{resource}" ) % { param : param , resource : self } unless parameters . include? ( param ) end arg_types = resource_type . argument_types parameters . each do | name , value | next unless t = arg_types [ name . to_s ] unless Puppet :: Pops :: Types :: TypeCalculator . instance? ( t , value . value ) inferred_type = Puppet :: Pops :: Types :: TypeCalculator . infer_set ( value . value ) actual = inferred_type . generalize ( ) fail Puppet :: ParseError , _ ( "Expected parameter '%{name}' of '%{value0}' to have type %{value1}, got %{value2}" ) % { name : name , value0 : self , value1 : t . to_s , value2 : actual . to_s } end end end
Verify that all required arguments are either present or
have been provided with defaults.
Verify that all required arguments are either present or have been provided with defaults .
# Perform optional type checking # Parameters is a map from name, to parameter, and the parameter again has name and value # untyped, and parameters are symbols here (aargh, strings in the type)
deprecated
Not used by Puppet
Not used by Puppet
api
None