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

Resource collectors can be assigned to variables by abusing chaining statements

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: PUP 3.7.5
    • Fix Version/s: PUP 4.1.0
    • Component/s: Language
    • Labels:
      None
    • Template:
    • Epic Link:
    • Story Points:
      1
    • Sprint:
      Language 2015-04-29
    • Release Notes:
      Bug Fix

      Description

      The 4x parser generally refuses to produce values from resource collectors, and errors if you put one where a value is expected. But since the value of a chaining statement is just the final term of the statement (regardless of arrow direction) and they accept collectors as operands:

      notify {"I go last.":}
      $myweirdchain = (file {"/tmp/thing": ensure => file,} -> Notify <| |>)
      notice( $myweirdchain )
      

      Notice: Scope(Class[main]): [#<Puppet::Pops::Evaluator::Collectors::CatalogCollector:0x007fe33da72c90>]
      

      I don't really have anything to add, and probably no one will ever try to do that. But it does seem unintended.

      risk: medium (manual validate only for now)
      probability: low
      severity: medium (confusion, possible abuse?)
      test layer: unit (no unit tests added in PR. Henrik Lindberg can you comment on if you think this needs testing, and at what layer?)

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  nick.fagerlund Nicholas Fagerlund
                  QA Contact:
                  Eric Thompson
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Zendesk Support