From fa935f639002f0333cadb34efaa4129842bca084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 9 Aug 2016 15:38:57 +0200 Subject: Factorize locales functions --- modules/locales/manifests/init.pp | 12 ++++-------- modules/locales/manifests/locale.pp | 7 +++++++ 2 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 modules/locales/manifests/locale.pp (limited to 'modules') 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 @@ class locales { - file_line { '/etc/locale.gen#fr_FR.UTF-8': - path => '/etc/locale.gen', - line => 'fr_FR.UTF-8 UTF-8 ', - match => '#?fr_FR.UTF-8 UTF-8 +$', + locales::locale { '/etc/locale.gen#fr_FR.UTF-8': + locale => 'fr_FR.UTF-8' } - file_line { '/etc/locale.gen#en_US.UTF-8': - path => '/etc/locale.gen', - line => 'en_US.UTF-8 UTF-8 ', - match => '#?en_US.UTF-8 UTF-8 +$', + locales::locale { '/etc/locale.gen#en_US.UTF-8': + locale => 'en_US.UTF-8' } exec { '/usr/bin/locale-gen': 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 @@ +define locales::locale ($locale, $charmap = 'UTF-8') { + file_line { "/etc/locale.gen#$locale": + path => '/etc/locale.gen', + line => "$locale $charmap ", + match => "#?$locale $charmap +$", + } +} -- cgit v1.2.3