diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-08-09 15:38:57 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-08-09 15:38:57 +0200 |
commit | fa935f639002f0333cadb34efaa4129842bca084 (patch) | |
tree | 994c27d051593e7e0829dcc67b7a690bed3cd80e /modules | |
parent | a880172b96e94f4f1c01d51d78305d712d1726b3 (diff) | |
download | Puppet-fa935f639002f0333cadb34efaa4129842bca084.tar.gz Puppet-fa935f639002f0333cadb34efaa4129842bca084.tar.zst Puppet-fa935f639002f0333cadb34efaa4129842bca084.zip |
Factorize locales functions
Diffstat (limited to 'modules')
-rw-r--r-- | modules/locales/manifests/init.pp | 12 | ||||
-rw-r--r-- | modules/locales/manifests/locale.pp | 7 |
2 files changed, 11 insertions, 8 deletions
diff --git a/modules/locales/manifests/init.pp b/modules/locales/manifests/init.pp index 6a5dc2a..982b48e 100644 --- a/modules/locales/manifests/init.pp +++ b/modules/locales/manifests/init.pp | |||
@@ -1,13 +1,9 @@ | |||
1 | class locales { | 1 | class locales { |
2 | file_line { '/etc/locale.gen#fr_FR.UTF-8': | 2 | locales::locale { '/etc/locale.gen#fr_FR.UTF-8': |
3 | path => '/etc/locale.gen', | 3 | locale => 'fr_FR.UTF-8' |
4 | line => 'fr_FR.UTF-8 UTF-8 ', | ||
5 | match => '#?fr_FR.UTF-8 UTF-8 +$', | ||
6 | } | 4 | } |
7 | file_line { '/etc/locale.gen#en_US.UTF-8': | 5 | locales::locale { '/etc/locale.gen#en_US.UTF-8': |
8 | path => '/etc/locale.gen', | 6 | locale => 'en_US.UTF-8' |
9 | line => 'en_US.UTF-8 UTF-8 ', | ||
10 | match => '#?en_US.UTF-8 UTF-8 +$', | ||
11 | } | 7 | } |
12 | exec { '/usr/bin/locale-gen': | 8 | exec { '/usr/bin/locale-gen': |
13 | subscribe => File_line['/etc/locale.gen#fr_FR.UTF-8', '/etc/locale.gen#en_US.UTF-8'], | 9 | subscribe => File_line['/etc/locale.gen#fr_FR.UTF-8', '/etc/locale.gen#en_US.UTF-8'], |
diff --git a/modules/locales/manifests/locale.pp b/modules/locales/manifests/locale.pp new file mode 100644 index 0000000..1eb14be --- /dev/null +++ b/modules/locales/manifests/locale.pp | |||
@@ -0,0 +1,7 @@ | |||
1 | define locales::locale ($locale, $charmap = 'UTF-8') { | ||
2 | file_line { "/etc/locale.gen#$locale": | ||
3 | path => '/etc/locale.gen', | ||
4 | line => "$locale $charmap ", | ||
5 | match => "#?$locale $charmap +$", | ||
6 | } | ||
7 | } | ||