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

Class parameter scope is not used when resolving qualified names

    Details

    • Template:
    • Team:
      Platform Core
    • Story Points:
      1
    • Sprint:
      Platform Core KANBAN
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      A regression in puppet 5.0.0 made it impossible to reference fully qualified variables in the default value expression for a parameter.
    • QA Risk Assessment:
      No Action
    • QA Risk Assessment Reason:
      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

            jsd-sla-details-panel

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support