Skip to main content

Deprecation: Deprecation of lc_all from locale resource (CHEF-27)

Setting the LC_ALL variable is NOT recommended. As a system-wide setting, LANG should provide the desired behavior. LC_ALL is intended to be used for temporarily troubleshooting issues rather than an everyday system setting. Changing LC_ALL can break Chef’s parsing of command output in unexpected ways. Use one of the more specific LC_ properties as needed. This deprecation warning was added in Chef Infra Client 15.0. Support for property lc_all will be removed for Chef Infra Client 16.0.

The Cookstyle cop ChefDeprecations/LocaleDeprecatedLcAllProperty has been introduced to detect and autocorrect this deprecation.

Remediation

Set LC_ALL in current shell as:

export LC_ALL="<locale_name>"

To check the locale value, run:

locale -v

You can also use file Resource and add this variable in any other file of your choice and then can source that file to reflect changes.

file "<path_to_file>" do
  content "LC_ALL=<locale_name>"
end

Where path_to_file could be any one of:

  • /etc/default/locale
  • /etc/sysconfig/i18n
  • /etc/environment

Setting LC_ variables varies by platform, but these are the common locations to configure LC_ variables.

Warning

Using the file Resource or other manual management method of LC configuration may overwrite settings from this resource and break your system.
Edit this page on GitHub

Thank you for your feedback!

×











Search Results