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

Create support for binary content on the File type

    Details

      Description

      Once the catalog is transferred in JSON, non-UTF-8 sequences will no longer be allowed in the content. This means that Files that have a content of some arbitrary data may or may not be able to be transferred.

      Henrik Lindberg suggested a solution to this that will allow us to do our switch to JSON but not require an entirely new catalog format. The idea is to create a function called binary(str) that takes a String and returns a Struct[data => String] where data is a UTF-8 compatible encoding of the bytes (not the characters) of the input String. The content parameter of File is then changed to accept either a String or a Struct[data => String]. When it receives a Struct[data => String] then the data element is decoded with the algorithm decided for the implementation of the binary(str) function.

      This solution should allow the follow manifests to continue to work:

      file { "/tmp/binary": content => binary(file("/local/binary")) }
      

      define my_file($content) {
        file { "/tmp/binary": content => $content }
      }
       
      my_file { "yep": content => binary(file("/local/binary")) }
      

      At least one variation on those will not work (because binary data will end up in the catalog):

      define my_file($content) {
        file { "/tmp/binary": content => binary($content) }
      }
       
      my_file { "yep": content => file("/local/binary") }
      

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  henrik.lindberg Henrik Lindberg
                  Reporter:
                  andy Andrew Parker
                  QA Contact:
                  Eric Thompson
                • Votes:
                  2 Vote for this issue
                  Watchers:
                  10 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: