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

templates in defined types in Puppet 4 (or 3.8 future parser) lost access to scope of calling class

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Do
    • Affects Version/s: PUP 3.8.5, PUP 4.8.2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      OS: Debian Linux (Jessie/Stretch)

    • Template:
    • Team:
      Puppet Developer Experience
    • Sprint:
      Forge - To Accept
    • QA Risk Assessment:
      Needs Assessment

      Description

      In Puppet 3.x, templates in defined types had access to the variables of the calling class, so defines could be treated more or less like native type. In 4.x, or with the future parser enabled in 3.8, this is no longer the case. This breaks a really important use case: generalized defines usable by multiple modules that create file resources using templates.

      To make matters worse, although I am just learning them, it appears that native types lack a core ability that defined types have – access to function call results on the server (as far as I can tell, they can only detect filesystem state on the client). This means that as of Puppet 4.x it appears to be impossible to create any helper that is simultaneously aware of the state of the filesystem on the server (e.g. the presence of files in various modules) and of the contents of the variables of the calling class. If I am reading the code right, the file type actually relies on the template function being called from the puppet resource outside of the type

      This has broken tens of thousands of lines of code, and it appears to be completely impossible to fix them, preventing a 3.8 to 4.8 upgrade. :/ It still appears possible to use the Puppet 3.8 packages from the Debian jessie-backports repository in Debian Stretch, so we can afford to wait a couple years for Puppet 5 and attempt a 3 to 5 transition instead (and we can't update the server to 4 anyway until 3.x client support is working), but I would greatly appreciate it if define scoping is returned to Puppet 3.x behavior in some future release.

        Attachments

          Activity

            People

            • Assignee:
              zed Zed Pobre
              Reporter:
              zed Zed Pobre
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support