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

lookups within hiera data values break %{literal('%')}

    XMLWordPrintable

Details

    • Hide


      some_text: "%

      {alias('label_format')}

      "
      label_format: "%

      {literal('%')}{vpc}_pub%{literal('%')} {az}"

      lookup('some_text', Data, 'first', '') should return the literal text "%{vpc}_pub%{az}

      " without any value substitution.

      Show
      — some_text: "% {alias('label_format')} " label_format: "% {literal('%')}{vpc}_pub%{literal('%')} {az}" lookup('some_text', Data, 'first', '') should return the literal text "%{vpc}_pub%{az} " without any value substitution.
    • Puppet Developer Experience
    • 2
    • PDE 2017-05-31
    • Major
    • 4 - 50-90% of Customers
    • 2 - Annoyance
    • 1 - ?
    • Hide
      The need for this is to enable storing ruby string format specifiers in the hiera data that are used within our custom types for generating labels and names for resources that are generated in line with a customer defined naming convention

      The work around is for us to create our own mark up format, and then translate into the ruby specification format within the custom provider
      Show
      The need for this is to enable storing ruby string format specifiers in the hiera data that are used within our custom types for generating labels and names for resources that are generated in line with a customer defined naming convention The work around is for us to create our own mark up format, and then translate into the ruby specification format within the custom provider
    • Bug Fix
    • In hiera data, if aliasing a key and the value for that key contained escaped interpolations those escaped interpolations would be taken as interpolations instead of keeping the aliased value intact. This is now fixed.
    • Manual
    • covered by unit tests; edge case

    Description

      consider the hiera data fragment:

      ---
      some_text: "%{alias('label_format')}"
      label_format: "%{literal('%')}{vpc}_pub%{literal('%')}{az}"
      


      When you lookup the value 'label_format' you correctly obtain the string

      "%{vpc}_pub%{az}"
      

      as the value. However, if you lookup the value 'some_text' then the result depends on whether

      %{vpc}
      

      and

      %{az}
      

      have valid substitutions. Without facts or variables, the current result from the lookup is the string "_pub"

      Until this bug is fixed, the utility of the %

      {literal('%')}

      function is limited to being used in values that are only directly requested.

      Attachments

        Activity

          People

            Unassigned Unassigned
            micptolshaw Michael Shaw
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support