[chef] 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: < >
  • To:
  • Subject: [chef] 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 01:27:15 -0700 (PDT)

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!



Archive powered by MHonArc 2.6.16.

§