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

Class parameter scope is not used when resolving qualified names

    XMLWordPrintable

Details

    • Platform Core
    • 1
    • Platform Core KANBAN
    • Needs Assessment
    • Bug Fix
    • A regression in puppet 5.0.0 made it impossible to reference fully qualified variables in the default value expression for a parameter.
    • No Action
    • test added already

    Description

      Looking at https://puppet.com/docs/puppet/5.0/release_notes.html there was a language deprecation that was missed.

      In Puppet 4, the following code works as expected and prints 'does it work yes'

      class foo ( 
        $var1 = 'does it work',
        $var2 = "${foo::var1} yes"
      ) { 
        notice($var2)
      }
       
      include 'foo'
      

      In Puppet 5, the same code only prints ' yes'

      Apparently, there was a change in the parser that means that local names can only be used when referencing earlier parameters.

      The corrected code would be:

      class foo ( 
        $var1 = 'does it work',
        $var2 = "${var1} yes"
      ) { 
        notice($var2)
      }
       
      include 'foo'
      

      CCing henrik.lindberg for validation that this is not a regression instead of a documentation bug

      Attachments

        Activity

          People

            Unassigned Unassigned
            peiriannydd Trevor Vaughan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support