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

Calling scope#tags results in undefined method

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • None
    • PUP 7.1.0, PUP 6.20.0
    • None
    • Coremunity
    • Platform Core KANBAN
    • Needs Assessment
    • Bug Fix
    • 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.
    • 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

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

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support