aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2016-08-09 15:38:57 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2016-08-09 15:38:57 +0200
commitfa935f639002f0333cadb34efaa4129842bca084 (patch)
tree994c27d051593e7e0829dcc67b7a690bed3cd80e
parenta880172b96e94f4f1c01d51d78305d712d1726b3 (diff)
downloadPuppet-fa935f639002f0333cadb34efaa4129842bca084.tar.gz
Puppet-fa935f639002f0333cadb34efaa4129842bca084.tar.zst
Puppet-fa935f639002f0333cadb34efaa4129842bca084.zip
Factorize locales functions
-rw-r--r--modules/locales/manifests/init.pp12
-rw-r--r--modules/locales/manifests/locale.pp7
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 @@
1class locales { 1class 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 @@
1define 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}