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

It is impossible to navigate an integer keyed Hiera hash using dotted keys

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 4.10.2
    • Component/s: None
    • Template:
    • Acceptance Criteria:
      Hide
      • A hash containing integer keys should be navigable by dotted keys with integers.
      • A hash containing keys that are strings that represent integers, should not be navigable by dotted keys with integers unless the integers are quoted.
      Show
      A hash containing integer keys should be navigable by dotted keys with integers. A hash containing keys that are strings that represent integers, should not be navigable by dotted keys with integers unless the integers are quoted.
    • Sub-team:
    • Team:
      Agent
    • Story Points:
      1
    • Sprint:
      Agent 2017-06-14
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      It is now possible to navigate/dig into hashes with integer keys when using dot notation - for example looking up "port.80.detail" in this hash.
      {code}
      { port => { 80 => { detail => 'wanted value'}}}
      {code}
      This failed earlier since an Integer key then only worked when digging into Array values.
      Show
      It is now possible to navigate/dig into hashes with integer keys when using dot notation - for example looking up "port.80.detail" in this hash. {code} { port => { 80 => { detail => 'wanted value'}}} {code} This failed earlier since an Integer key then only worked when digging into Array values.
    • QA Risk Assessment:
      Manual
    • QA Risk Assessment Reason:
      Unlikely to regress

      Description

      With the fix of PUP-7594, it is now possible to use hashes with integer keys in Hiera. Those keys can however not be navigated using a dotted key with integer numbers in it. I.e.

      ports:
        80:
          test: test
      

      cannot be navigated using the key 'ports.80'. This is because integers in dotted keys are presumed to be positional indexes in arrays, not keys in hashes.

      It should be possible to navigate a hash containing integer keys. A hash containing strings that represent integers should also be possible to navigate, but then, the integer in the dotted key must be quoted. E.g.

      ports:
        "80":
          test: test
      

      should not be found by key ports.80. Instead, ports.'80' must be used.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              thomas.hallgren Thomas Hallgren
              QA Contact:
              Eric Delaney
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support