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

Resource overrides for defined types is order dependent

    Details

    • Type: Bug
    • Status: Ready for Engineering
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: PUP 4.2.2
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      The following compiles:

      define foo($bar) {
          notice $bar
      }
       
      foo { foo:
      }
       
      Foo[foo] {
          bar => baz
      }
      

      The notice is with "baz" as expected. This happens to work because Foo[foo] exists when the override expression is evaluated.

      However, swapping the resource override with the resource declaration:

      define foo($bar) {
          notice $bar
      }
       
      Foo[foo] {
          bar => baz
      }
       
      foo { foo:
      }
      

      Results in:

      Error: Must pass bar to Foo[foo] at foo.pp:9 on node foo
      

      This is because resource overrides for resources that have not yet been declared are processed by the compiler after generating the defined types.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              peter.huene Peter Huene
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Zendesk Support