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

undef not usable in collector search

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Duplicate
    • PUP 4.2.2
    • PUP 4.6.0
    • Language
    • None
    • Hide

      That a query such as

      Foo <| x == undef |> { x => 'baz' }
      

      matches instances of Foo with an undef x attribute.

      Show
      That a query such as Foo <| x == undef |> { x => 'baz' } matches instances of Foo with an undef x attribute.
    • 1
    • Reviewed
    • Bug Fix
    • Using `undef` in a collector lead to an error. Literal `undef` can now be used in collector queries.

    Description

      The documentation for collector search expressions states that, for the equality search ==, undef is a valid right operand.

      However, when I try to use it, I get an Error: Evaluation Error: Error while evaluating a Virtual Query, Cannot transform object of class Puppet::Pops::Model::LiteralUndef error.

      Sample code:

      define foo (
        $x = undef ,
        $y = undef ,
      ) {
        notify { "foo::${x}::${y}": }
      }
       
      foo { 'bar': y => 'quux' }
      Foo <| x == undef |> { x => 'baz' }
      

      This is the result:

      $ puppet apply -t test.pp
      Info: Loading facts
      Info: Loading facts
      Error: Evaluation Error: Error while evaluating a Virtual Query, Cannot transform object of class Puppet::Pops::Model::LiteralUndef at …/test.pp:9:1 on node …
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              JohnsonEarls Johnson Earls
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support