Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package resource : Support non-EN locale in Chef 12 #2695

Closed
BarthV opened this issue Dec 22, 2014 · 3 comments · Fixed by #2727
Closed

Package resource : Support non-EN locale in Chef 12 #2695

BarthV opened this issue Dec 22, 2014 · 3 comments · Fixed by #2727
Assignees
Labels
Type: Bug Does not work as expected.
Milestone

Comments

@BarthV
Copy link

BarthV commented Dec 22, 2014

Ohai Chefs !

Just wanted to report a bug when using a simple package ressource :

Vagrant precise VM :

~# cat /etc/issue
Ubuntu 12.04.4 LTS

~# chef-apply -v
Chef: 12.0.3

~# locale
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
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=en_US.UTF-8
~# echo 'package "ntp"' > /tmp/test.rb && chef-apply /tmp/test.rb
Recipe: (chef-apply cookbook)::(chef-apply recipe)
  * apt_package[ntp] action install
    - install version 1:4.2.6.p3+dfsg-1ubuntu3.1 of package ntp

Now just change locale to fr_FR :

~# locale
LANG=fr_FR.UTF-8
LANGUAGE=fr_FR.UTF-8
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=fr_FR.UTF-8
~# echo 'package "ntp"' > /tmp/test.rb && chef-apply /tmp/test.rb
Recipe: (chef-apply cookbook)::(chef-apply recipe)
  * apt_package[ntp] action install
    * No version specified, and no candidate version available for ntp
    ================================================================================
    Error executing action `install` on resource 'apt_package[ntp]'
    ================================================================================

    Chef::Exceptions::Package
    -------------------------
    No version specified, and no candidate version available for ntp

    Resource Declaration:
    ---------------------
    # In /tmp/test.rb

      1: package "ntp"

    Compiled Resource:
    ------------------
    # Declared in /tmp/test.rb:1:in `run_chef_recipe'

    apt_package("ntp") do
      action :install
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      package_name "ntp"
      timeout 900
      declared_type :package
      cookbook_name "(chef-apply cookbook)"
      recipe_name "(chef-apply recipe)"
    end

[2014-12-22T13:48:19+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2014-12-22T13:48:19+00:00] FATAL: Chef::Exceptions::Package: apt_package[ntp] ((chef-apply cookbook)::(chef-apply recipe) line 1) had an error: Chef::Exceptions::Package: No version specified, and no candidate version available for ntp

Same conf with chef 11 :

~# chef-apply -v
Chef: 11.16.4

~# echo 'package "ntp"' > /tmp/test.rb && chef-apply /tmp/test.rb
Recipe: (chef-apply cookbook)::(chef-apply recipe)
  * package[ntp] action install
    - install version 1:4.2.6.p3+dfsg-1ubuntu3.1 of package ntp

All we can say about this issue :

  • package ressource seems to have a dependency to a specific (en) locale in Chef 12 (for some output parsing i guess)
  • It affects Ubuntu (debian & OS based on yum not tested yet)
  • It affects both VM (Vagrant, ...) and bare metal servers
  • Same behaviour with Ubuntu 14.04 and more
  • This was not blocking in Chef 11 and less.

So is it possible to support non-EN locale or create a workaround to force EN locale inside Chef ?
It would be great for all Chefs around the world.

Thanks for all !

@brauliobo
Copy link

any workaround for this?

@brauliobo
Copy link

Workarounded with:

  # avoid problems with locales on chef
  # workaround https://github.com/opscode/chef/issues/2695
  ENV['LANG'] = 'en_US.UTF-8'
  ENV['LANGUAGE'] = ENV['LANG']
  ENV['LC_ALL'] = ENV['LANG']

on solo.rb

@lamont-granquist
Copy link
Contributor

looks like LANGUAGE has priority over even LC_ALL

@lamont-granquist lamont-granquist modified the milestones: 12.1.0, 12.0.4 Jan 23, 2015
@thommay thommay added Type: Bug Does not work as expected. and removed Bug labels Jan 25, 2017
@chef chef locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Bug Does not work as expected.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants