[chef] Re: Re: Issues with Locale on Remote Client Node when running knife ssh: chef-client for Ubuntu 12.04 and chef 10 or chef 11


Chronological Thread 
  • From: Harry Yeh < >
  • To:
  • Subject: [chef] Re: Re: Issues with Locale on Remote Client Node when running knife ssh: chef-client for Ubuntu 12.04 and chef 10 or chef 11
  • Date: Fri, 26 Apr 2013 10:26:07 -0700

Actually I tried setting the environment and overriding it but it doesn't work

I actually try to set the environment


On Fri, Apr 26, 2013 at 8:28 AM, Daniel DeLeo < " target="_blank"> > wrote:

On Friday, April 26, 2013 at 1:27 AM, " target="_blank"> wrote:

Currently I'm using chef 11 (just upgraded, hoping the problem would go away
but it hasn't!)

So here's my problem.

When I type the command "locale" on my ubuntu machine the default output I get
is the following:

LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Assume that I have a cook book that will write a locale to a temp file in a
recipe and cookbook

knife node run_list add server1 recipe[writelocale]

the following is the contents of the recipe/writelocale.rb

execute "locale" do
command "locale >> /tmp/locale.txt"
end
This is a tricky one. The underlying mixlib-shellout library that Chef uses to run commands sets the locale to "C" to avoid encoding issues and get consistent output from localized programs (Chef has to parse output from many commands and this doesn't work if you unexpectedly get Spanish output).


I think you should be able to add `environment "LC_ALL" => nil` to your execute command to override this.

HTH,

-- 
Daniel DeLeo




--
Harry Yeh
CEO / CTO
Comet Computing
(604)304-1603

Web: http://www.cometcomputing.com
Me: http://www.linkedin.com/in/harryyeh
Twitter: http://twitter.com/harryyeh
Facebook: http://www.facebook.com/harryyeh       

Confidentiality Notice:

This electronic mail transmission and any accompanying attachments contain confidential information intended only for the use of the individual or entity named above. Any dissemination, distribution, copying or action taken in reliance on the contents of this communication by anyone other than the intended recipient is strictly prohibited. If you have received this communication in error please immediately delete the E-mail and notify the sender at the above E-mail address.



Archive powered by MHonArc 2.6.16.

§