Code Monkey home page Code Monkey logo

puppet-locales's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppet-locales's Issues

puppet-locales breaks on CentOS

Hi,

We started using this module and found it's failing with 'Error 400 on SERVER: No matching value for selector param 'CentOS' at /etc/puppet/modules/locales/manifests/params.pp:6' on our CentOS servers. It'd be really nice if it works on CentOS in general, but I'd be happy if it just defaulted to give a warning and not fail, breaking Puppet entirely on those.

Anyways, thank you for writing and publishing this module; it should help a lot with ensuring consistent locales in our environment. I'll work on writing a fix for this unless someone else gets to it first.

Sincerely,
Teran

duplicate package resource

Can you have an option to manage_package or something? I have another module that package declares 'glibc-common', which winds up as a duplicate package conflict.

Then I believe I could, for example, hiera set locales::manage_package:false and not hit the duplicate package declaration.

Not generating locale on Archlinux

The default value for $config_file is wrong for ArchLinux. It is currently:

$config_file       = '/etc/locales.gen'

It should be:

$config_file       = '/etc/locale.gen'

It is possible to work around this be manually setting config_file as a parameter, eg:

  class { 'locales':
    default_locale  => 'en_US.UTF-8',
    locales         => ['en_US.UTF-8 UTF-8', 'fr_CH.UTF-8 UTF-8'],
    config_file     => '/etc/locale.gen',
  }

Add RedHat/CentOS support

I need to set locales in RedHat/CentOS using a puppet module and I think it would be an interesting feature for the puppet-locales. From what I saw the way of setting locales in RedHat/CentOS is quite different from Ubuntu/Debian. What would be the best way to do this?

To add a new locale the CentOS use:

localedef -i <language> -f <encoding> <locale_name>

To set the default language and others locales variables we edit the file /etc/sysconfig/i18n. For example:

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

locale.gen is ignored in Ubuntu

The locales in locale.gen are ignored by the locale-gen command in Ubuntu (at least in Ubuntu 12.04).

From what I can see you should update the file /var/lib/locales/supported.d/local which does have an effect on the locales generated by locale-gen

Redhat -> RedHat in params.pp?

Hi,

I get a 'Unsupported platform: RedHat' message when I try to apply your lovely module.

# facter operatingsystem
RedHat

When I change the Redhat to RedHat in the case statement in params.pp it works fine.

Sorry no pull request, I can't push to github from work.

Thanks,
Frank

Add support for puppet 5

Because of version_requirement >= 4.0.0 < 5.0.0 in metadata.json, puppet 5 is not supported.

Most probably, this will just work on puppet 5, and the version requirement can be updated to < 6.0.0

As CentOS is dead, we migrating to Rocky, we need suport for it

Hello, hello.
First thank you for your effort about writing this nice module. Everything about it simply works, except the fact we need support for modern distributions like Rocky ;-)

I tried to roll out today on Rocky and got this error:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Unsupported platform: Rocky (file: /etc/puppetlabs/code/environments/production/modules/locales/manifests/params.pp, line: 103, column: 7) on node scout.home.lan

So I'm kindly pleasing you to add that support to the selector when you have time.
Thanks in advance.

[question] what re-adds the comments in /etc/locale.gen?

i am running debian stretch and manage my locales with puppet.

my /etc/locale.gen looks quite nice:

# File managed by puppet

en_US.UTF-8 UTF-8
de_DE.UTF-8 UTF-8

but quite often i notice that the file must have been touched by another app because if i do a puppetrun is see that all the default comments are removed again:

...
==> myserver.example.com: -# uz_UZ@cyrillic UTF-8
==> myserver.example.com: -# ve_ZA UTF-8
==> myserver.example.com: -# vi_VN UTF-8
==> myserver.example.com: -# wa_BE ISO-8859-1
==> myserver.example.com: -# wa_BE.UTF-8 UTF-8
==> myserver.example.com: -# wa_BE@euro ISO-8859-15
==> myserver.example.com: -# wae_CH UTF-8
==> myserver.example.com: -# wal_ET UTF-8
==> myserver.example.com: -# wo_SN UTF-8
==> myserver.example.com: -# xh_ZA ISO-8859-1
==> myserver.example.com: -# xh_ZA.UTF-8 UTF-8
==> myserver.example.com: -# yi_US CP1255
==> myserver.example.com: -# yi_US.UTF-8 UTF-8
==> myserver.example.com: -# yo_NG UTF-8
==> myserver.example.com: -# yue_HK UTF-8
...

does someone know why this happens? which app / cron job always my puppet managed locale file?
maybe this cause can directly prevented in this module.

does the locale package gets so often updated? i am running unattendet updates, so this can also be a reason.

no /etc/default/locales generated.

Hi,

I've found a number of machines do not have /etc/default/locale generated.

I use your package as:

    class {'locales':
        autoupgrade => true,
        locales     => 'en_US.UTF-8 UTF-8',
    }

From searching around, it appears that either reconfiguring locales (on Debian) https://giantdorks.org/alain/error-unable-to-open-env-file-etcdefaultlocale-no-such-file-or-directory/ or running 'update-locales' fixes the problem http://superuser.com/questions/236023/unable-to-open-env-file-etc-default-locale-no-such-file-or-directory

Perhaps one of those should also be done (as a notify?)

Puppet forge page not listing Archlinux as supported

Hey Saz,

Can you update the Puppet forge page to state that the module supports Archlinux?

I was going to add support and send you a PR but on closer inspection there is already support in the module but it is not listed as such on Puppet forge.

Thanks,

Alan

Please add support for Sangoma

Sangoma is the "OS" for freepbx, which is a RHEL clone

diff --git a/manifests/params.pp b/manifests/params.pp
index 6331242..504aa1c 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -59,7 +59,7 @@ class locales::params {
         }
       }
     }
-    /(RedHat|CentOS|OracleLinux|Fedora|Amazon|CloudLinux|AlmaLinux|Rocky)/: {
+    /(RedHat|CentOS|OracleLinux|Fedora|Amazon|CloudLinux|AlmaLinux|Rocky|Sangoma)/: {
       $package = 'glibc-common'
       $update_locale_pkg = false
       $locale_gen_cmd = undef

Clarify dependency chain between `locale-gen` and `update-locales`

I'm running puppet with ordering = random to help me learn about Puppet(for a vagrant machine, so wanting to run puppet once and that's it.)

Unfortunately I keep getting errors from puppet-locales where the update-locales command is being run before the locale-gen command meaning the locale I want to set(en_NZ.UTF-8) doesn't exist.

Add support for Rocky Linux

See https://rockylinux.org.

This is a RHEL 8 rebuild, same as (currently) CentOS, AlmaLinux, etc.

# facter os.name
Rocky

This seems to be all that's needed to fix it:

    /(RedHat|CentOS|OracleLinux|Fedora|Amazon|CloudLinux|AlmaLinux|Rocky)/: {

I can do that as a patch or a PR if you prefer.

Add License

Hello.

First of all, it is a great module. Thanks for your work.

May I ask you to consider adding a LICENSE to it?

Incorrect locales format

Hello.

I have basic vagrant machine (ubuntu/trusty64), and I tested only locales (I got sources from github), so my default.pp =

class { 'locales':
default_locale => 'pl_PL.UTF-8',
locales => ['pl_PL.UTF-8 UTF-8', 'en_US.UTF-8 UTF-8'],
}

After first start, I can login by vagrant ssh, but after "locale" I see:

vagrant@some-project-dev-box:~$ locale
LANG=pl_PL.UTF-8"
LANGUAGE=
"C_CTYPE="pl_PL.UTF-8"
"C_NUMERIC="pl_PL.UTF-8"
"C_TIME="pl_PL.UTF-8"
"C_COLLATE="pl_PL.UTF-8"
"C_MONETARY="pl_PL.UTF-8"
"C_MESSAGES="pl_PL.UTF-8"
"C_PAPER="pl_PL.UTF-8"
"C_NAME="pl_PL.UTF-8"
"C_ADDRESS="pl_PL.UTF-8"
"C_TELEPHONE="pl_PL.UTF-8"
"C_MEASUREMENT="pl_PL.UTF-8"
"C_IDENTIFICATION="pl_PL.UTF-8"
LC_ALL=

But it should be:

LANG=pl_PL.UTF-8
LANGUAGE=
C_CTYPE="pl_PL.UTF-8"
C_NUMERIC="pl_PL.UTF-8"
C_TIME="pl_PL.UTF-8"
C_COLLATE="pl_PL.UTF-8"
C_MONETARY="pl_PL.UTF-8"
C_MESSAGES="pl_PL.UTF-8"
C_PAPER="pl_PL.UTF-8"
C_NAME="pl_PL.UTF-8"
C_ADDRESS="pl_PL.UTF-8"
C_TELEPHONE="pl_PL.UTF-8"
C_MEASUREMENT="pl_PL.UTF-8"
C_IDENTIFICATION="pl_PL.UTF-8"
LC_ALL=

And after vagrant halt, I can't again run vagrant.

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...

Use systemd/localctl ?

Since all major distribution support systemd, this module may use localctl instead define the $locale::default_file manually. For example:

# localectl set-locale LANG=en_US.utf8 LANGUAGE=en_US.utf8 LC_CTYPE=en_US.utf8

Changelog?

Could you please add a changelog of changes as other Puppet Forge contributors do?

Release 2.0.1 on puppetforge ?

hi, I use your module on my servers, and it was whether it was possible to release version 2.0.1 on puppet forge?
In advance thank you! (for default_locales parameter :-))

$default_file changed in Debian

The $default_file = /etc/default/locale directive should be changed to $default_file = '/etc/locale.conf' at least for Debian 12 in the file manifests/params.pp.

Gentoo warning

Hello,

Gentoo is provoking a warning in puppetserver:

2022-04-15T13:36:32.320Z WARN [qtp1144132856-5237] [puppetserver] Puppet Unknown variable: 'locales::params::update_locale_cmd'. (file: /etc/puppetlabs/code/environments/production/modules/locales/manifests/init.pp, line: 146, column: 51)

The correction is quite simple, in manifests/params.pp, it's missing an undef for update_locale_cmd; patch enclosed.

Thanks !
gentoo.txt

locale-gen not working

I'm always getting the following error message back from Puppet:

Error: /Stage[main]/Locales/Exec[locale-gen]: Failed to call refresh: /usr/sbin/locale-gen: 24: /usr/sbin/locale-gen: rm: not found
Generating locales (this might take a while)...
/usr/sbin/locale-gen: 1: /usr/sbin/locale-gen: sed: not found
  .UTF-8/usr/sbin/locale-gen: 1: /usr/sbin/locale-gen: sed: not found
.../usr/sbin/locale-gen: 1: /usr/sbin/locale-gen: sed: not found
Error: /Stage[main]/Locales/Exec[locale-gen]: /usr/sbin/locale-gen: 24: /usr/sbin/locale-gen: rm: not found
Generating locales (this might take a while)...
/usr/sbin/locale-gen: 1: /usr/sbin/locale-gen: sed: not found
  .UTF-8/usr/sbin/locale-gen: 1: /usr/sbin/locale-gen: sed: not found
.../usr/sbin/locale-gen: 1: /usr/sbin/locale-gen: sed: not found

I call your module with the following arguments within my manifest:

class { "locales":
  default_locale => "en_US.UTF-8",
  autoupgrade    => true,
}

Now the funny part, if I change the params.pp file of your module (line 12 and 13):

      $locale_gen_cmd = 'sudo /usr/sbin/locale-gen'
      $update_locale_cmd = 'sudo /usr/sbin/update-locale'

Now everything works just fine and as expected. Any idea?

Liebe Grüße

PS: Could it be that the exec calls just need a path set to search in for the missing rm and sed commands. I'm out of time right now, so can't test, but will do so later and report back (unless you've found a solution before I have).

Cannot set LC_CTYPE to default locale

puppet-locales version 2.3.0

puppet definition:

Set system locales

class { 'locales':
default_locale => 'en_HK.UTF-8',
locales => ['en_HK.UTF-8'],
lc_ctype => 'en_HK.UTF-8',
lc_collate => 'en_HK.UTF-8',
lc_time => 'en_HK.UTF-8',
lc_numeric => 'en_HK.UTF-8',
lc_monetary => 'en_HK.UTF-8',
lc_messages => 'en_HK.UTF-8',
lc_paper => 'en_HK.UTF-8',
lc_name => 'en_HK.UTF-8',
lc_address => 'en_HK.UTF-8',
lc_telephone => 'en_HK.UTF-8',
lc_measurement => 'en_HK.UTF-8',
lc_identification => 'en_HK.UTF-8',
}

Error:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = "en_HK.UTF-8",
LC_MONETARY = "en_HK.UTF-8",
LC_CTYPE = "en_HK.UTF-8",
LC_COLLATE = "en_HK.UTF-8",
LC_ADDRESS = "en_HK.UTF-8",
LC_TELEPHONE = "en_HK.UTF-8",
LC_MESSAGES = "en_HK.UTF-8",
LC_NAME = "en_HK.UTF-8",
LC_MEASUREMENT = "en_HK.UTF-8",
LC_IDENTIFICATION = "en_HK.UTF-8",
LC_NUMERIC = "en_HK.UTF-8",
LC_PAPER = "en_HK.UTF-8",
LANG = "en_HK.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

How could I fix this issue?

Archlinux support

Here is a rough plan for anybody wanting to add Archlinux (capitalization is exactly this):

$package           = 'glibc'
$update_locale_pkg = false
$locale_gen_cmd    = '/usr/bin/locale-gen' # /usr/sbin will also work but considered legacy
$config_file       = '/etc/locales.gen'
$default_file      = '/etc/locale.conf'

I don't know Puppet well yet to attempt a PR.

Fails on ubuntu 16.04.1

Asking puppet apply to do this

class english {

  class { 'locales':
default_locale  => 'en_GB.UTF-8',
locales         => ['en_GB.UTF-8 UTF-8', 'en_US.UTF-8 UTF-8'],
  }
}

leads to death thus:

Error: Could not set 'file' on ensure: No such file or directory @ dir_s_rmdir - /var/lib/locales/supported.d/local20161004-32612-1qyuldy.lock at 191:/etc/puppet/modules/locales/manifests/init.pp
Error: Could not set 'file' on ensure: No such file or directory @ dir_s_rmdir - /var/lib/locales/supported.d/local20161004-32612-1qyuldy.lock at 191:/etc/puppet/modules/locales/manifests/init.pp
Wrapped exception:
No such file or directory @ dir_s_rmdir - /var/lib/locales/supported.d/local20161004-32612-1qyuldy.lock
Error: /Stage[main]/Locales/File[/var/lib/locales/supported.d/local]/ensure: change from absent to file failed: Could not set 'file' on ensure: No such file or directory @ dir_s_rmdir - /var/lib/locales/supported.d/local20161004-32612-1qyuldy.lock at 191:/etc/puppet/modules/locales/manifests/init.pp
Notice: /Stage[main]/Locales/Exec[locale-gen]: Dependency File[/var/lib/locales/supported.d/local] has failures: true
Warning: /Stage[main]/Locales/Exec[locale-gen]: Skipping because of failed dependencies

The missing file /var/lib/locales/supported.d is probably a red herring, since it appears to be create on successful locale generation (cf. here).

The bug appears to exist both in the version pulled from puppet forge and that from github.

I'm using puppet 3.8.5.

Config dir does not exist without language pack

If there is no language pack installed on Ubuntu (tested on 16.04 xenial), the directory /var/lib/locales/supported.d does not exist. This makes the locales module fail, because it tries to create the file local in that directory without making sure it exists:

Error: Could not set 'file' on ensure: No such file or directory @ dir_s_mkdir - /var/lib/locales/supported.d/local20160608-22855-1nxbc2h.lock at 184:/etc/puppet/code/environments/production/modules/locales/manifests/init.pp
Error: Could not set 'file' on ensure: No such file or directory @ dir_s_mkdir - /var/lib/locales/supported.d/local20160608-22855-1nxbc2h.lock at 184:/etc/puppet/code/environments/production/modules/locales/manifests/init.pp
Wrapped exception:
No such file or directory @ dir_s_mkdir - /var/lib/locales/supported.d/local20160608-22855-1nxbc2h.lock
Error: /Stage[main]/Locales/File[/var/lib/locales/supported.d/local]/ensure: change from absent to file failed: Could not set 'file' on ensure: No such file or directory @ dir_s_mkdir - /var/lib/locales/supported.d/local20160608-22855-1nxbc2h.lock at 184:/etc/puppet/code/environments/production/modules/locales/manifests/init.pp

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.