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

hiera('some::key', undef) returns empty string

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Done
    • Affects Version/s: PUP 3.7.3, PUP 3.7.5
    • Fix Version/s: PUP 3.8.0, PUP 4.1.0
    • Component/s: DSL
    • Labels:
    • Template:
    • Story Points:
      2
    • Sprint:
      Language 2015-02-04, Language 2015-02-18, Language 2015-04-01, Language 2015-04-15
    • Release Notes:
      Bug Fix

      Description

      When using the hiera() function with a second parameter of undef, Hiera returns the empty string for the value. When using Puppet 3.7 future parser, this means that Hiera returns a truthy value when it cannot find a key.

      In the Puppet 3 language, this doesn't matter because '' == undef evaluates to true.

      A workaround for this is to specify a second parameter of false instead of undef, but that doesn't make this behavior any less confusing.

      Final resolution: In the Puppet 4 language, the hiera functions will now respect and return a default of undef, same as they do in the Puppet 3 language. (in comment)

      risk assessment: high
      probability: high (regression)
      severity: medium (can work around in puppet code, but it's not-expected)
      highest test layer: acceptance
      FR only for now (acceptance is ticketed in a larger test for all functions) PUP-4342

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  rw Ryan Whitehurst
                  QA Contact:
                  Eric Thompson
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  12 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Zendesk Support