Issue #15062 has been updated by Deepak Giridharagopal.
I think there's a few options available, though we can basically only do these
things in Telly (due to compat):
* Just state that all template content and .pp files must be UTF-8, and fail if
they don't appear to be. We've got code in the PuppetDB terminus that could
help with that
* In addition to the above statement, provide a version of the template
function (and perhaps other functions, like generate) that take the character
encoding as an argument. So you could do "template("foo.erb", "latin-1") or
something to tell us what the encoding is, and we use that to convert to UTF-8
internally
I'd be okay with just the first, personally, though that pushes the burden of
character set conversion to the user (they'd have to use iconv on the command
line or something).
Relevant mailing list thread about this, where I propose just enforcing UTF-8:
[https://groups.google.com/forum/?fromgroups#!topic/puppet-users/-OhWwhdq2-U%5B1-25%5D](https://groups.google.com/forum/?fromgroups#!topic/puppet-users/-OhWwhdq2-U%5B1-25%5D)
----------------------------------------
Bug #15062: puppet fails if template contains invalid utf-8
https://projects.puppetlabs.com/issues/15062#change-68900
Author: Chris Price
Status: Accepted
Priority: Normal
Assignee: Deepak Giridharagopal
Category: templates
Target version:
Affected Puppet version: 2.7.16
Keywords: character encoding binary utf8
Branch:
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.
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.