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

puppet fails if template contains invalid utf-8

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 3.4.0
    • Component/s: None
    • Labels:
    • Template:

      Description

      If you attempt to use a file resource with a 'content' parameter pointing at a template, and the template contains binary content, you may get an error like this:

          Error: Failed to apply catalog: Parameter content failed: Munging failed for value ...
          invalid byte sequence in UTF-8
      

      I've reproduced the failure in 2.7.16 and 3.x, though the error messages differ slightly between the two (and also depending on whether you repro via 'apply' or via master/agent run).

      I'm attaching the binary file that I'm using to repro. Save it into a directory structure like this:

          modules/mymod/templates/mytemplate.erb
      

      Add the "modules" directory to your module path and then you can repro with the following manifest:

          file { "/tmp/myfile":
              mode => 755,
              content => template("mymod/mytemplate.erb"),
          }
      

      Note that if you use the 'source' parameter rather than the 'content' parameter (and avoid calling the template function), the manifest can be applied successfully; so the issue is when bringing in binary data as a string.

        Attachments

          Activity

            People

            Assignee:
            chuck Charlie Sharpsteen
            Reporter:
            redmine.exporter redmine.exporter
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support