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

cannot call 4.x functions from 3.x function ERB templates

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 3.8.2, PUP 4.2.0
    • Component/s: DOCS
    • Labels:
      None
    • Template:
    • Story Points:
      2
    • Sprint:
      Language 2015-06-24
    • Release Notes:
      Bug Fix

      Description

      It is not possible to call a 4.x function from a 3.x function or ERB template because that logic does not have ready access to a mechanism to perform such a call correctly.

      We should add a new method of scope that works the same way as how the puppet language evaluator performs the call. i.e.:

      • The call is made with arguments using ruby/4.x semantics (no funny undef stuff)
      • If a 4.x function is found it wins
      • If a 3.x function is found the arguments are transformed to the 3.x convention (i.e. undef funny stuff).
      • in a 3.x version, 4.x. functions are only found if parser==future.

      The solution is to add a method call_function on Scope. It accepts the name of a function as its first argument, followed by all arguments in an Array. It also accepts a Ruby block (as a lambda).

      ORIGINAL REPORT


      escaped and reported from outside:
      https://groups.google.com/forum/#!msg/puppet-users/Ht_5d2Wb6VA/v1lVtw031DkJ

        Attachments

          Issue Links

            Activity

            erict Eric Thompson created issue -
            erict Eric Thompson made changes -
            Field Original Value New Value
            Link This issue relates to PUP-4695 [ PUP-4695 ]
            erict Eric Thompson made changes -
            henrik.lindberg Henrik Lindberg made changes -
            Sprint Language 2015-06-24 [ 920 ]
            Story Points 2
            Description escaped and reported from outside:
            https://groups.google.com/forum/#!msg/puppet-users/Ht_5d2Wb6VA/v1lVtw031DkJ

            It is not possible to call a 4.x function from a 3.x function or ERB template because that logic does not have ready access to a mechanism to perform such a call correctly.

            We should add a new method of scope that works the same way as how the puppet language evaluator performs the call. i.e.:
            * The call is made with arguments using ruby/4.x semantics (no funny undef stuff)
            * If a 4.x function is found it wins
            * If a 3.x function is found the arguments are transformed to the 3.x convention (i.e. undef funny stuff).

            Since
            ORIGINAL REPORT
            ----
            escaped and reported from outside:
            https://groups.google.com/forum/#!msg/puppet-users/Ht_5d2Wb6VA/v1lVtw031DkJ

            Scope Change Reason found by community - painful to work around
            Scope Change Category Found [ 11410 ]
            Fix Version/s PUP 3.8.2 [ 13415 ]
            Fix Version/s PUP 4.2.0 [ 13200 ]
            henrik.lindberg Henrik Lindberg made changes -
            Remote Link This issue links to "PR-4033 (Web Link)" [ 31061 ]
            henrik.lindberg Henrik Lindberg made changes -
            Status Open [ 1 ] Ready for Review [ 10004 ]
            Assignee Henrik Lindberg [ henrik.lindberg ]
            henrik.lindberg Henrik Lindberg made changes -
            Status Ready for Review [ 10004 ] Ready for Merge [ 10002 ]
            henrik.lindberg Henrik Lindberg made changes -
            Description It is not possible to call a 4.x function from a 3.x function or ERB template because that logic does not have ready access to a mechanism to perform such a call correctly.

            We should add a new method of scope that works the same way as how the puppet language evaluator performs the call. i.e.:
            * The call is made with arguments using ruby/4.x semantics (no funny undef stuff)
            * If a 4.x function is found it wins
            * If a 3.x function is found the arguments are transformed to the 3.x convention (i.e. undef funny stuff).

            Since
            ORIGINAL REPORT
            ----
            escaped and reported from outside:
            https://groups.google.com/forum/#!msg/puppet-users/Ht_5d2Wb6VA/v1lVtw031DkJ

            It is not possible to call a 4.x function from a 3.x function or ERB template because that logic does not have ready access to a mechanism to perform such a call correctly.

            We should add a new method of scope that works the same way as how the puppet language evaluator performs the call. i.e.:
            * The call is made with arguments using ruby/4.x semantics (no funny undef stuff)
            * If a 4.x function is found it wins
            * If a 3.x function is found the arguments are transformed to the 3.x convention (i.e. undef funny stuff).
            * in a 3.x version, 4.x. functions are only found if parser==future.

            The solution is to add a method {{call_function}} on Scope. It accepts the name of a function as its first argument, followed by all arguments in an Array. It also accepts a Ruby block (as a lambda).

            ORIGINAL REPORT
            ----
            escaped and reported from outside:
            https://groups.google.com/forum/#!msg/puppet-users/Ht_5d2Wb6VA/v1lVtw031DkJ

            thomas.hallgren Thomas Hallgren made changes -
            Assignee Thomas Hallgren [ thomas.hallgren ]
            thomas.hallgren Thomas Hallgren made changes -
            Status Ready for Merge [ 10002 ] Ready for CI [ 10003 ]
            henrik.lindberg Henrik Lindberg made changes -
            Comment [ Merged to 3.x at: b2d5834 ]
            thomas.hallgren Thomas Hallgren made changes -
            Assignee Thomas Hallgren [ thomas.hallgren ]
            kylo Kylo Ginsberg made changes -
            Release Notes Bug Fix [ 11407 ]
            kylo Kylo Ginsberg made changes -
            Status Ready for CI [ 10003 ] Ready for Test [ 10029 ]
            Assignee QA [ qa ]
            henrik.lindberg Henrik Lindberg made changes -
            Component/s DOCS [ 11226 ]
            kurt.wall Kurt Wall made changes -
            Assignee qa [ qa ] Kurt Wall [ kurt.wall ]
            kurt.wall Kurt Wall made changes -
            Assignee Kurt Wall [ kurt.wall ]
            erict Eric Thompson made changes -
            Assignee Eric Thompson [ eric.thompson ]
            erict Eric Thompson made changes -
            Resolution Fixed [ 1 ]
            Assignee Eric Thompson [ eric.thompson ]
            Status Ready for Test [ 10029 ] Resolved [ 5 ]
            erict Eric Thompson made changes -
            Remote Link This issue links to "test case: should be able to call 4.x functions from 3.x functions and ERB templates (Web Link)" [ 31520 ]
            erict Eric Thompson made changes -
            QA Status Reviewed [ 10700 ]
            josh Josh Cooper made changes -
            Status Resolved [ 5 ] Closed [ 6 ]
            derek.austin Dee Austin made changes -
            Workflow Scrum Team Workflow [ 381713 ] Scrum Teams Workflow [ 471589 ]
            kenn Kenn Hussey made changes -
            Workflow Scrum Teams Workflow [ 471589 ] Scrum Team Workflow [ 564754 ]

              People

              • Assignee:
                Unassigned
                Reporter:
                erict Eric Thompson
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support