[chef] Re: invalid multibyte char (US-ASCII) in template file


Chronological Thread 
  • From: Daniel DeLeo < >
  • To:
  • Subject: [chef] Re: invalid multibyte char (US-ASCII) in template file
  • Date: Thu, 8 Aug 2013 14:24:05 -0700


On Wednesday, August 7, 2013 at 5:04 PM, Davis, Bruce wrote:

However, when I try to upload the cookbook, I get:

$ knife cookbook upload <cookbook_name>
Uploading <cookbook_name> [0.0.1]
FATAL: Erb template templates/default/file.sql.erb has a syntax error:
FATAL: -:75: invalid multibyte char (US-ASCII)
FATAL: -:1: invalid multibyte char (US-ASCII)
FATAL: -:1: syntax error, unexpected $end
FATAL: ...hese brave men foughtd diedr freedom.\\",\\"audio\\":{...
FATAL: ... ^

The syntax check works by piping the output of `erubis -X` (extract ruby code) to `ruby -c` (ruby syntax check). It's not clear from the error which one of this is failing.

Some things you might be able to try:

Add this to your template:

    <% #encoding: utf-8
    %>

Hack the syntax check by creating a script called `erubis` that higher precedence in the PATH than the real one.

I think the real solution to this is to add `:env => {"LC_ALL" => nil}` to the call to shell_out on this line:

https://github.com/opscode/chef/blob/master/lib/chef/cookbook/syntax_check.rb#L174

You could probably monkey patch that in via your knife.rb (though if this solves your issue, please submit a proper patch, too).

HTH,

-- 
Daniel DeLeo




Archive powered by MHonArc 2.6.16.

§