Uploaded image for project: 'Hiera'
  1. Hiera
  2. HI-531

Eyaml with hiera_array() creates literal ENC[...] array element along with decrypted string

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Incomplete
    • Affects Version/s: HI 3.2.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
    • Template:

      Description

      hiera_array() in conjunction with eyaml will yield an array containing the decrypted element, but also a spurious element containing the eyaml literal.

      Consider the following hiera file:

      ---
      array_w_encrypted_element:
        - a
        - b
        - ENC[GPG,hQIOA3fxw9YrYu65EAf/RpCJIsF7b4huIxBBn0tf8BtozuBjNJQ0sBjamJDOjBY4HrhSn7h2pQLBZgRf70JDhkxFNBtrLd2qS0EfPv57RCVlnh4mWKS/DfVJqzQSKLszmKGpSavc+muxeFU0QkpZWIWFZZQ6EG3VJ7HMmrfSLe6DONaQkl58Ie1h9yS7TDK/wGsArEPkQ2BLw/989RRUX0r6qcjSiZ9ooUDufipCO1F4ceBV/CRn7/DoSkF0T0qKeM45jQ/WprYTfO8rFkG9Yy8HSP9pdwa0eSui60fTRbjt47I53ys3+XQXrG2VCF2YXqCMWl8XcgDolDdNkxEDVa6a6O5y1kHF9w6+V+nQcAgAii0qAhL0vWY9fmHPDmySXr5tpDjjSkWc64F1OC8nWD4ifz5rEEU1pEQUVDYTJ4xenvndkgA4EKOQauo4lBQh9MRPAoG+tc78OQNqidW0SHBgm/Cdf/g4DLonZcs1sPj8ZbTvnALsSoiRfphXAzrBfTVJfAvXuPZ1dALNRAlXd1lEneRE7r9yXgGGxD4pfXLnLPfaPGvhNmNXQ7+w0ym4cQIqDUw2PcPV5Z+uJ1+6gO5G9E/8JgW7tkY2VIBZBO+ptMP3FAYGj9HM5UNPK7gONkUwgBm+Zw27lyZ4vqVm+vxzD8LtOqqPmRiwLD5y8dSRR0IxkcAYgNp2wP+GgrObrNI8ASx0OYRjH9tOOul8QUtJYlskY4C1oQI4YhBlOXiG3PdkwFoKSEdoLcX2i3kWC5MKL5dm/yi12tUZhGTd]
      

      And the following manifest:

      class manifests::eyaml::woes {
        $_data = hiera_array('array_w_encrypted_element')
        file { '/tmp/foo.json':
          ensure  => present,
          content => join($_data," "),
        }
      }
      

      This yields the following file:

      a b c ENC[GPG,hQIOA3fxw9YrYu65EAf/RpCJIsF7b4huIxBBn0tf8BtozuBjNJQ0sBjamJDOjBY4HrhSn7h2pQLBZgRf70JDhkxFNBtrLd2qS0EfPv57RCVlnh4mWKS/DfVJqzQSKLszmKGpSavc+muxeFU0QkpZWIWFZZQ6EG3VJ7HMmrfSLe6DONaQkl58Ie1h9yS7TDK/wGsArEPkQ2BLw/989RRUX0r6qcjSiZ9ooUDufipCO1F4ceBV/CRn7/DoSkF0T0qKeM45jQ/WprYTfO8rFkG9Yy8HSP9pdwa0eSui60fTRbjt47I53ys3+XQXrG2VCF2YXqCMWl8XcgDolDdNkxEDVa6a6O5y1kHF9w6+V+nQcAgAii0qAhL0vWY9fmHPDmySXr5tpDjjSkWc64F1OC8nWD4ifz5rEEU1pEQUVDYTJ4xenvndkgA4EKOQauo4lBQh9MRPAoG+tc78OQNqidW0SHBgm/Cdf/g4DLonZcs1sPj8ZbTvnALsSoiRfphXAzrBfTVJfAvXuPZ1dALNRAlXd1lEneRE7r9yXgGGxD4pfXLnLPfaPGvhNmNXQ7+w0ym4cQIqDUw2PcPV5Z+uJ1+6gO5G9E/8JgW7tkY2VIBZBO+ptMP3FAYGj9HM5UNPK7gONkUwgBm+Zw27lyZ4vqVm+vxzD8LtOqqPmRiwLD5y8dSRR0IxkcAYgNp2wP+GgrObrNI8ASx0OYRjH9tOOul8QUtJYlskY4C1oQI4YhBlOXiG3PdkwFoKSEdoLcX2i3kWC5MKL5dm/yi12tUZhGTd]
      

      The same applies to hiera_hash() when one of the keys contains a nested array.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              faxmodem Fabien Wernli
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support