[chef] Re: 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: Daniel DeLeo < >
  • To:
  • Subject: [chef] Re: 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 15:09:51 -0700


On Friday, April 26, 2013 at 3:01 PM, AJ Christensen wrote:

Use the 'environment' parameter to the execute resource to set
environment variables, i.e;

execute 'locale'
environment 'LC_CTYPE' => 'en_US.UTF-8'
command 'locale | tee /tmp/locale.txt'
end

Cheers,

AJ
mixlib-shellout cares in particular about LC_ALL. Given this code:

execute 'locale' do
  environment 'LC_ALL' => nil
  command 'locale | tee /tmp/locale.txt'
end

running `chef-apply locale.rb`, I get:

 > cat locale.txt 
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=


-- 
Daniel DeLeo
 


Tried thia

execute "locale" do
command "
LC_CTYPE=en_US.UTF-8
locale >> /tmp/locale.txt"
end


that even shows up as

LC_CTYPE=C

You can try it



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


When I run this command

knife ssh name:server1 -x root -P password1 -a ipaddress "sudo -i
chef-client"

to run a recipe remotely I always end up with this.

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

I'm guessing it has something to do with the shell or how chef-server is
causing the remote ssh shell to execute. I only thing I can think of there
is
some chef process whether it's RabbitMQ or something else that is changing
the
default shell locale to C vs UTT-8. I've tried numerous things, including
trying to set the LC_TYPE="en_US.UTF-8" but I can't seem to do it, the
locale
always default to C. This is particularly a problem when I try to install
things like Postgresql, since I end up with the following instead of what
I
actually need.

What I should See

List of databases
Name | Owner | Encoding | Collate | Ctype | Access
privileges

-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
+
| | | | |
postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
+
| | | | |
postgres=CTc/postgres


When I remote and run apt-get install -y postgresql-server-dev-9.1

List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges

-----------+----------+-----------+---------+-------+-----------------------
postgres | postgres | SQL_ASCII | C | C |
template0 | postgres | SQL_ASCII | C | C | =c/postgres
+
| | | | |
postgres=CTc/postgres
template1 | postgres | SQL_ASCII | C | C | =c/postgres
+
| | | | |
postgres=CTc/postgres




I've been stuck on this issue for a few days now seems trivial at first
but
it's become and issue since it affects what packages I can install with
the
Proper Locale.

Please help thanks!




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


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.

§