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

Add depreciation warning for hyphenated class names

    Details

    • Type: Task
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: PUP 3.7.0
    • Component/s: Compiler
    • Labels:
      None

      Description

      As decided in PUP-1397, hyphenated class names will no longer be allowed by the Puppet 4.x parser.

      # tst.pp
       
      class my-class {
        $test = "content"
        notify {$test:}
      }
       
      include 'my-class'
      

      Currently, the standard parser accepts these names without complaint:

      # puppet apply tst.pp 
       
      Notice: Compiled catalog for os-head-centos.puppetdebug.vlan in environment production in 0.06 seconds
      Notice: content
      Notice: /Stage[main]/My-class/Notify[content]/message: defined 'message' as 'content'
      Notice: Finished catalog run in 0.11 seconds
      

      In 3.4.x, the future parser emits a depreciation warning:

      # puppet apply tst.pp --parser=future
       
      Warning: Deprecation notice: A Host Class Definition may not have a name containing a hyphen. The name 'my-class' is not legal at /vagrant/PUP-1397/tst.pp:1:1
      Notice: Compiled catalog for os-head-centos.puppetdebug.vlan in environment production in 0.85 seconds
      Notice: content
      Notice: /Stage[main]/My-class/Notify[content]/message: defined 'message' as 'content'
      Notice: Finished catalog run in 0.23 seconds
      

      In Puppet 3.5.0 and newer, the future parser emits a hard error:

      # puppet apply tst.pp --parser=future
      Error: Could not parse for environment production: Syntax error at 'my-class' at /vagrant/PUP-1397/tst.pp:1:7 on node os-head-centos.puppetdebug.vlan
      Error: Could not parse for environment production: Syntax error at 'my-class' at /vagrant/PUP-1397/tst.pp:1:7 on node os-head-centos.puppetdebug.vlan
      

      A depreciation warning needs to be added to the standard parser before the jump to 4.x.

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  andy Andrew Parker
                  Reporter:
                  chuck Charlie Sharpsteen
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: