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

undef not usable in collector search

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • 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
    • Language 2016-07-27
    • 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

              john.duarte John Duarte
              JohnsonEarls Johnson Earls
              Votes:
              1 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support