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

Calling scope#tags results in undefined method

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 7.1.0, PUP 6.20.0
    • Component/s: None
    • Labels:
    • Template:
      PUP Bug Template
    • Team:
      Coremunity
    • Sprint:
      Platform Core KANBAN
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Calling the `tags` method within an ERB template would result in a confusing error message. The error message now makes it clear that that method is not supported.
    • QA Risk Assessment:
      Needs Assessment

      Description

      The following prints a confusing error message in 4.10.5 and up:

      $ bundle exec puppet apply -e "notice(inline_template('<%= tags %>'))"
      Error: Evaluation Error: Error while evaluating a Function Call, Failed to parse inline template: undefined method `tags' for Scope(Class[main]):Puppet::Parser::Scope (line: 1, column: 8) on node localhost
      

      Within the body of the ERB template, self is TemplateWrapper and TemplateWrapper#tags is a valid method that delegates to the Scope, but that doesn't forward it to the parser resource, due to https://github.com/puppetlabs/puppet/commit/02576c98fa5a8b7decb7b53c9407bf8523947220#diff-b929053e73f66fa12eac30a6222276489f6ea778ec407f99183a03e763b38623

      We should either remove the tags method from TemplateWrapper or raise a more meaningful error (to call all_tags instead) /cc Ben Ford, David Schmitt

        Attachments

          Activity

            People

            Assignee:
            josh Josh Cooper
            Reporter:
            josh Josh Cooper
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support