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

Parser does not allow comma after last element in nested Variant Types

    XMLWordPrintable

Details

    • Needs Assessment
    • Needs Assessment

    Description

      Puppet Version: 6.7.2
      Puppet Server Version: 6.5.0
      OS Name/Version: Ubuntu 18.04.3 LTS

      The following code does not parse:

      type A = Variant[Pattern[/a/]]
      type B = Variant[
        A,
      ]
       
      define x (
        Variant[
          A,
        ] $a,
      ) {
      }
      

      with the following error:

      Error: Could not parse for environment production: Syntax error at ']' (file: ~/test.pp, line: 9, column: 3)

      Desired Behavior:

      The code should be parsed without error.

      Actual Behavior:

      The parsing the code with puppet parser validate ~/test.pp throws the above mentioned error.

      The code does parse if the comma behind type A in the Variant block is removed. But this is a inconsistent behavior, because, as far as i know, all array like enumerations in puppet allow a comma after the last element. Also it works if the type is declared with the type keyword. And it works if the elements in the enumeration are not Variants themselves.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            vicinus Reinhard Vicinus
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Zendesk Support