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

Order of include and resource-like class declarations should not be important

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Accepted
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: PUP 4.2.2
    • Fix Version/s: None
    • Component/s: Compiler
    • Labels:
      None
    • Template:
    • Team:
      Coremunity

      Description

      We run into this occasionally, but it's always a giant pain to fix, because we have to mess with parse order. For example, OPS-7041.

      Trivial example:

      $ puppet apply -e '

      class a ( $v = "v" ) {
        notify { "class a $v": }
      }
       
      class { "a": v=>"b" }
      include a
      

      '
      Notice: Compiled catalog for zhora.local in environment production in 0.30 seconds
      Notice: class a b
      Notice: /Stage[main]/A/Notify[class a b]/message: defined 'message' as 'class a b'
      Notice: Applied catalog in 0.01 seconds

      $ puppet apply -e '

      class a ( $v = "v" ) {
        notify { "class a $v": }
      }
       
      include a
      class { "a": v=>"b" }
      

      '
      Warning: Config file /Users/daniel/.puppetlabs/etc/code/hiera.yaml not found, using Hiera defaults
      Error: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[A] is already declared; cannot redeclare at line 6 at line 6:1 on node zhora.local

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            daniel.parks Daniel Parks
            QA Contact:
            Sean Griffin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:

                Zendesk Support