Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-9467

Type validation fails when there is no type - needs human-readable error message

    XMLWordPrintable

Details

    • Coremunity
    • Platform Core KANBAN
    • Customer Feedback
    • Bug Fix
    • Hide
      When using the type `Optional` without any arguments, this could result in an internal error. This is now fixed. Note that `Optional` on its own means the same as `Any` and thus you should always supply a type argument T with is the desired type if the value is not `undef`.
      Show
      When using the type `Optional` without any arguments, this could result in an internal error. This is now fixed. Note that `Optional` on its own means the same as `Any` and thus you should always supply a type argument T with is the desired type if the value is not `undef`.

    Description

      A class with an optional parameter with no type that defaults to undef isn't handled well by /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/types/type_mismatch_describer.rb

      For example if I have a class:

      class test::validation (
       Optional $whatever = undef
      ){
      notice($whatever)
       
      }
      

      and in hiera:

      test::validation::whatever: 1234

      Applying the class to an agent results in the stack trace I've attached here.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            erik.hansen Erik Hansen
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support