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

Array conversion to String using 'short-form' broken

    XMLWordPrintable

Details

    • Froyo
    • Needs Assessment
    • Bug Fix
    • Hide
      Fixed recognition of short form Arrays and Hashes

      This release fixes a regression in the string formatting rules that caused a short form for an Array or Hash to not be recognized. For example `String([1,[2,3],4], '%#a")` would not format with indentation, but would format the long form `String([1,[2,3],4], {Array => { format => '%#a"}})`. Now the short form works for Array and Hash as intended.
      Show
      Fixed recognition of short form Arrays and Hashes This release fixes a regression in the string formatting rules that caused a short form for an Array or Hash to not be recognized. For example `String([1,[2,3],4], '%#a")` would not format with indentation, but would format the long form `String([1,[2,3],4], {Array => { format => '%#a"}})`. Now the short form works for Array and Hash as intended.
    • Needs Assessment

    Description

      https://puppet.com/docs/puppet/5.3/function.html#conversion-to-string

      and

      http://puppet-on-the-edge.blogspot.com/2016/05/converting-and-formatting-data-like-pro.html both have examples of how to get Puppet to format strings when converting from Arrays.

      eg.

      $str = String([10], "%(a") # produces '("10")'
      

      # Formatting with indentation
      String([1, [2, 3], 4], "%#a")
      # produces:
      # [1,
      #  [2, 3],
      #  4]
      

      It appears these examples haven't worked since puppet 4.8 (they work in 4.7.1).

      The long form still works.
      eg

      String([1, [2, 3], 4], Array => { format => "%#a"})
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            alexjfisher Alexander Fisher
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support