From 121603db004c6a20505572ecf853a479d9a052b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20=E2=80=9Csaz=E2=80=9D=20Zieger?= Date: Mon, 20 Oct 2025 11:42:40 +0200 Subject: [PATCH] update README, add REFERENCE.md --- README.md | 23 ---- REFERENCE.md | 323 ++++++++++++++++++++++++++++++++++++++++++++++ manifests/init.pp | 227 +++++++++++++------------------- 3 files changed, 410 insertions(+), 163 deletions(-) create mode 100644 REFERENCE.md diff --git a/README.md b/README.md index 6972214..ab99ffc 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,6 @@ Manage locales via Puppet -### Supported Puppet versions -* Puppet >= 4 -* Last version supporting Puppet 3: v2.4.0 - ## Usage By default, en and de locales will be generated. @@ -26,7 +22,6 @@ Configure a bunch of locales. Advanced usage allows you to select which locales will be configured as well as the default one. - ``` class { 'locales': default_locale => 'en_US.UTF-8', @@ -45,21 +40,3 @@ for available LC_* environment variables and their descriptions: lc_paper => 'de_DE.UTF-8', } ``` - -## Other class parameters -* locales: Name of locales to generate, default: ['en_US.UTF-8 UTF-8', 'de_DE.UTF-8 UTF-8'] -* ensure: present or absent, default: present -* default_locale: string, default: 'C'. Set the default locale. -* lc_ctype: string, default: undef. Character classification and case conversion. -* lc_collate: string, default: undef. Collation order. -* lc_time: string, default: undef. Date and time formats. -* ... -* autoupgrade: true or false, default: false. Auto-upgrade package, if there is a newer version. -* package: string, default: OS specific. Set package name, if platform is not supported. -* config_file: string, default: OS specific. Set config_file, if platform is not supported. -* locale_gen_command: string, default: OS specific. Set locale_gen_command, if platform is not supported. -* Suse specific: - * root_uses_lang: if set to 'ctype', root will be stay POSIX, set to 'yes' to change root to the global language as well. Defaults to 'ctype'. - * installed_languages: blank for english, otherwise space seperated list. Used by Yast2 only. - * auto_detect_utf8: Workaround for missing forward of LANG and LC variables of e.g. ssh login connections. Defaults to 'no'. - * input_method: A default input method to be used in X11. For more details see the comments at the top of /etc/X11/xim on a Suse system. diff --git a/REFERENCE.md b/REFERENCE.md new file mode 100644 index 0000000..2d49bbc --- /dev/null +++ b/REFERENCE.md @@ -0,0 +1,323 @@ +# Reference + + + +## Table of Contents + +### Classes + +* [`locales`](#locales): Manage locales +* [`locales::params`](#locales--params): Default params for locales + +## Classes + +### `locales` + +Manage locales + +#### Examples + +##### Basic usage + +```puppet +class { 'locales': + locales => [ 'en_US.UTF-8 UTF-8', 'de_DE.UTF-8 UTF-8', 'en_GB.UTF-8 UTF-8', ], + default_locale => 'en_GB.UTF-8', + lc_time => 'en_DK.UTF-8' +} +``` + +#### Parameters + +The following parameters are available in the `locales` class: + +* [`locales`](#-locales--locales) +* [`ensure`](#-locales--ensure) +* [`default_locale`](#-locales--default_locale) +* [`lc_ctype`](#-locales--lc_ctype) +* [`lc_collate`](#-locales--lc_collate) +* [`lc_time`](#-locales--lc_time) +* [`lc_numeric`](#-locales--lc_numeric) +* [`lc_monetary`](#-locales--lc_monetary) +* [`lc_messages`](#-locales--lc_messages) +* [`lc_paper`](#-locales--lc_paper) +* [`lc_name`](#-locales--lc_name) +* [`lc_address`](#-locales--lc_address) +* [`lc_telephone`](#-locales--lc_telephone) +* [`lc_measurement`](#-locales--lc_measurement) +* [`lc_identification`](#-locales--lc_identification) +* [`lc_all`](#-locales--lc_all) +* [`autoupgrade`](#-locales--autoupgrade) +* [`package`](#-locales--package) +* [`config_file`](#-locales--config_file) +* [`locale_gen_cmd`](#-locales--locale_gen_cmd) +* [`language`](#-locales--language) +* [`root_uses_lang`](#-locales--root_uses_lang) +* [`installed_languages`](#-locales--installed_languages) +* [`auto_detect_utf8`](#-locales--auto_detect_utf8) +* [`input_method`](#-locales--input_method) +* [`default_file`](#-locales--default_file) +* [`update_locale_pkg`](#-locales--update_locale_pkg) +* [`update_locale_cmd`](#-locales--update_locale_cmd) +* [`supported_locales`](#-locales--supported_locales) +* [`manage_package`](#-locales--manage_package) + +##### `locales` + +Data type: `Array[String]` + +List of name of locales to generate + +Default value: `['en_US.UTF-8 UTF-8', 'de_DE.UTF-8 UTF-8']` + +##### `ensure` + +Data type: `Enum['present', 'absent']` + +Ensure if present or absent. + +Default value: `'present'` + +##### `default_locale` + +Data type: `Optional[String]` + +The value of the LANG environment variable. Used by the locale system as +default for other LC_* variables that have not been set explicitly. When +setting this make sure the desired locale exists by specifying it in the +*locales* parameter. + +Default value: `undef` + +##### `lc_ctype` + +Data type: `Optional[String]` + +Character classification and case conversion. How characters are +classified as letters, numbers etc. This determines things like how +characters are converted between upper and lower case. + +Default value: `$locales::params::lc_ctype` + +##### `lc_collate` + +Data type: `Optional[String]` + +Collation order. How strings (file names...) are alphabetically sorted. +Using the "C" or "POSIX" locale here results in a strcmp()-like sort +order, which may be preferable to language-specific locales. + +Default value: `$locales::params::lc_collate` + +##### `lc_time` + +Data type: `Optional[String]` + +Date and time formats. How your time and date are formatted. Use for +example "en_DK.UTF-8" to get a 24-hour-clock in some programs. + +Default value: `$locales::params::lc_time` + +##### `lc_numeric` + +Data type: `Optional[String]` + +Non-monetary numeric formats. How you format your numbers. For example, +in many countries a period (.) is used as a decimal separator, while +others use a comma (,). + +Default value: `$locales::params::lc_numeric` + +##### `lc_monetary` + +Data type: `Optional[String]` + +Monetary formats. What currency you use, its name, and its symbol. + +Default value: `$locales::params::lc_monetary` + +##### `lc_messages` + +Data type: `Optional[String]` + +Formats of informative and diagnostic messages and interactive responses. + +Default value: `$locales::params::lc_messages` + +##### `lc_paper` + +Data type: `Optional[String]` + +Paper size. + +Default value: `$locales::params::lc_paper` + +##### `lc_name` + +Data type: `Optional[String]` + +Name formats. How names are represented (surname first or last, etc.). + +Default value: `$locales::params::lc_name` + +##### `lc_address` + +Data type: `Optional[String]` + +Address formats and location information. How addresses are formatted +(country first or last, where zip code goes etc.). + +Default value: `$locales::params::lc_address` + +##### `lc_telephone` + +Data type: `Optional[String]` + +Telephone number formats. + +Default value: `$locales::params::lc_telephone` + +##### `lc_measurement` + +Data type: `Optional[String]` + +Measurement units (Metric or Other). What units of measurement are used +(feet, meters, pounds, kilos etc.). + +Default value: `$locales::params::lc_measurement` + +##### `lc_identification` + +Data type: `Optional[String]` + +Metadata about the locale information. + +Default value: `$locales::params::lc_identification` + +##### `lc_all` + +Data type: `Optional[String]` + +Primary Language + +Default value: `$locales::params::lc_all` + +##### `autoupgrade` + +Data type: `Boolean` + +Upgrade package automatically, if there is a newer version. + +Default value: `false` + +##### `package` + +Data type: `String` + +Name of the package. +Only set this, if your platform is not supported or you know, what you're doing. + +Default value: `$locales::params::package` + +##### `config_file` + +Data type: `Optional[String]` + +Main configuration file. +Only set this, if your platform is not supported or you know, what you're doing. + +Default value: `$locales::params::config_file` + +##### `locale_gen_cmd` + +Data type: `Optional[String]` + +Command to generate locales. +Only set this, if your platform is not supported or you know, what you're doing. + +Default value: `$locales::params::locale_gen_cmd` + +##### `language` + +Data type: `Optional[String]` + + + +Default value: `undef` + +##### `root_uses_lang` + +Data type: `Optional[String]` + + + +Default value: `$locales::params::root_uses_lang` + +##### `installed_languages` + +Data type: `String` + + + +Default value: `$locales::params::installed_languages` + +##### `auto_detect_utf8` + +Data type: `String` + + + +Default value: `$locales::params::auto_detect_utf8` + +##### `input_method` + +Data type: `String` + + + +Default value: `$locales::params::input_method` + +##### `default_file` + +Data type: `String` + + + +Default value: `$locales::params::default_file` + +##### `update_locale_pkg` + +Data type: `Variant[Boolean, String]` + + + +Default value: `$locales::params::update_locale_pkg` + +##### `update_locale_cmd` + +Data type: `Optional[String]` + + + +Default value: `$locales::params::update_locale_cmd` + +##### `supported_locales` + +Data type: `Optional[String]` + + + +Default value: `$locales::params::supported_locales` + +##### `manage_package` + +Data type: `Boolean` + + + +Default value: `true` + +### `locales::params` + +Default params for locales + diff --git a/manifests/init.pp b/manifests/init.pp index 8c29a2a..a3fb9cf 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,151 +1,98 @@ -# Class: locales +# @summary Manage locales # -# This module manages locales -# -# Parameters: -# [*locales*] -# Name of locales to generate -# Default: [ 'en_US.UTF-8 UTF-8', 'de_DE.UTF-8 UTF-8', ] -# -# [*ensure*] -# Ensure if present or absent. -# Default: present -# -# [*default_locale*] -# The value of the LANG environment variable. Used by the locale system as -# default for other LC_* variables that have not been set explicitly. When -# setting this make sure the desired locale exists by specifying it in the -# *locales* parameter. -# Example: default_locale => 'en_GB.UTF-8' -# Default: undef -# -# [*lc_ctype*] -# Character classification and case conversion. How characters are -# classified as letters, numbers etc. This determines things like how -# characters are converted between upper and lower case. -# Default: undef -# -# [*lc_collate*] -# Collation order. How strings (file names...) are alphabetically sorted. -# Using the "C" or "POSIX" locale here results in a strcmp()-like sort -# order, which may be preferable to language-specific locales. -# Default: undef -# -# [*lc_time*] -# Date and time formats. How your time and date are formatted. Use for -# example "en_DK.UTF-8" to get a 24-hour-clock in some programs. -# Default: undef -# -# [*lc_numeric*] -# Non-monetary numeric formats. How you format your numbers. For example, -# in many countries a period (.) is used as a decimal separator, while -# others use a comma (,). -# Default: undef -# -# [*lc_monetary*] -# Monetary formats. What currency you use, its name, and its symbol. -# Default: undef -# -# [*lc_messages*] -# Formats of informative and diagnostic messages and interactive responses. -# Default: undef -# -# [*lc_paper*] -# Paper size. -# Default: undef -# -# [*lc_name*] -# Name formats. How names are represented (surname first or last, etc.). -# Default: undef -# -# [*lc_address*] -# Address formats and location information. How addresses are formatted -# (country first or last, where zip code goes etc.). -# Default: undef -# -# [*lc_telephone*] -# Telephone number formats. -# Default: undef -# -# [*lc_measurement*] -# Measurement units (Metric or Other). What units of measurement are used -# (feet, meters, pounds, kilos etc.). -# Default: undef -# -# [*lc_identification*] -# Metadata about the locale information. -# Default: undef -# -# [*lc_all*] -# Primary Language -# Default: undef -# -# [*autoupgrade*] -# Upgrade package automatically, if there is a newer version. -# Default: false -# -# [*package*] -# Name of the package. -# Only set this, if your platform is not supported or you know, what you're doing. -# Default: auto-set, platform specific -# -# [*config_file*] -# Main configuration file. -# Only set this, if your platform is not supported or you know, what you're doing. -# Default: auto-set, platform specific -# -# [*locale_gen_command*] -# Command to generate locales. -# Only set this, if your platform is not supported or you know, what you're doing. -# Default: auto-set, platform specific -# -# Actions: -# Installs locales package, generates specified locales and sets -# locale-related environment variables in the appropriate system-wide -# configuration file. -# -# Requires: -# Nothing -# -# Sample Usage: +# @example Basic usage # class { 'locales': # locales => [ 'en_US.UTF-8 UTF-8', 'de_DE.UTF-8 UTF-8', 'en_GB.UTF-8 UTF-8', ], # default_locale => 'en_GB.UTF-8', # lc_time => 'en_DK.UTF-8' # } # -# [Remember: No empty lines between comments and class definition] +# @param locales +# List of name of locales to generate +# @param ensure +# Ensure if present or absent. +# @param default_locale +# The value of the LANG environment variable. Used by the locale system as +# default for other LC_* variables that have not been set explicitly. When +# setting this make sure the desired locale exists by specifying it in the +# *locales* parameter. +# @param lc_ctype +# Character classification and case conversion. How characters are +# classified as letters, numbers etc. This determines things like how +# characters are converted between upper and lower case. +# @param lc_collate +# Collation order. How strings (file names...) are alphabetically sorted. +# Using the "C" or "POSIX" locale here results in a strcmp()-like sort +# order, which may be preferable to language-specific locales. +# @param lc_time +# Date and time formats. How your time and date are formatted. Use for +# example "en_DK.UTF-8" to get a 24-hour-clock in some programs. +# @param lc_numeric +# Non-monetary numeric formats. How you format your numbers. For example, +# in many countries a period (.) is used as a decimal separator, while +# others use a comma (,). +# @param lc_monetary +# Monetary formats. What currency you use, its name, and its symbol. +# @param lc_messages +# Formats of informative and diagnostic messages and interactive responses. +# @param lc_paper +# Paper size. +# @param lc_name +# Name formats. How names are represented (surname first or last, etc.). +# @param lc_address +# Address formats and location information. How addresses are formatted +# (country first or last, where zip code goes etc.). +# @param lc_telephone +# Telephone number formats. +# @param lc_measurement +# Measurement units (Metric or Other). What units of measurement are used +# (feet, meters, pounds, kilos etc.). +# @param lc_identification +# Metadata about the locale information. +# @param lc_all +# Primary Language +# @param autoupgrade +# Upgrade package automatically, if there is a newer version. +# @param package +# Name of the package. +# Only set this, if your platform is not supported or you know, what you're doing. +# @param config_file +# Main configuration file. +# Only set this, if your platform is not supported or you know, what you're doing. +# @param locale_gen_cmd +# Command to generate locales. +# Only set this, if your platform is not supported or you know, what you're doing. class locales ( - Array[String] $locales = ['en_US.UTF-8 UTF-8', 'de_DE.UTF-8 UTF-8'], - String $ensure = 'present', - Optional[String] $default_locale = undef, - Optional[String] $language = undef, - Optional[String] $lc_ctype = $locales::params::lc_ctype, - Optional[String] $lc_collate = $locales::params::lc_collate, - Optional[String] $lc_time = $locales::params::lc_time, - Optional[String] $lc_numeric = $locales::params::lc_numeric, - Optional[String] $lc_monetary = $locales::params::lc_monetary, - Optional[String] $lc_messages = $locales::params::lc_messages, - Optional[String] $lc_paper = $locales::params::lc_paper, - Optional[String] $lc_name = $locales::params::lc_name, - Optional[String] $lc_address = $locales::params::lc_address, - Optional[String] $lc_telephone = $locales::params::lc_telephone, - Optional[String] $lc_measurement = $locales::params::lc_measurement, - Optional[String] $lc_identification = $locales::params::lc_identification, - Optional[String] $lc_all = $locales::params::lc_all, - Optional[String] $root_uses_lang = $locales::params::root_uses_lang, - String $installed_languages = $locales::params::installed_languages, - String $auto_detect_utf8 = $locales::params::auto_detect_utf8, - String $input_method = $locales::params::input_method, - Boolean $autoupgrade = false, - String $package = $locales::params::package, - Optional[String] $config_file = $locales::params::config_file, - Optional[String] $locale_gen_cmd = $locales::params::locale_gen_cmd, - String $default_file = $locales::params::default_file, - Variant[Boolean, String] $update_locale_pkg = $locales::params::update_locale_pkg, - Optional[String] $update_locale_cmd = $locales::params::update_locale_cmd, - Optional[String] $supported_locales = $locales::params::supported_locales, # ALL locales support - Boolean $manage_package = true, + Array[String] $locales = ['en_US.UTF-8 UTF-8', 'de_DE.UTF-8 UTF-8'], + Enum['present', 'absent'] $ensure = 'present', + Optional[String] $default_locale = undef, + Optional[String] $language = undef, + Optional[String] $lc_ctype = $locales::params::lc_ctype, + Optional[String] $lc_collate = $locales::params::lc_collate, + Optional[String] $lc_time = $locales::params::lc_time, + Optional[String] $lc_numeric = $locales::params::lc_numeric, + Optional[String] $lc_monetary = $locales::params::lc_monetary, + Optional[String] $lc_messages = $locales::params::lc_messages, + Optional[String] $lc_paper = $locales::params::lc_paper, + Optional[String] $lc_name = $locales::params::lc_name, + Optional[String] $lc_address = $locales::params::lc_address, + Optional[String] $lc_telephone = $locales::params::lc_telephone, + Optional[String] $lc_measurement = $locales::params::lc_measurement, + Optional[String] $lc_identification = $locales::params::lc_identification, + Optional[String] $lc_all = $locales::params::lc_all, + Optional[String] $root_uses_lang = $locales::params::root_uses_lang, + String $installed_languages = $locales::params::installed_languages, + String $auto_detect_utf8 = $locales::params::auto_detect_utf8, + String $input_method = $locales::params::input_method, + Boolean $autoupgrade = false, + String $package = $locales::params::package, + Optional[String] $config_file = $locales::params::config_file, + Optional[String] $locale_gen_cmd = $locales::params::locale_gen_cmd, + String $default_file = $locales::params::default_file, + Variant[Boolean, String] $update_locale_pkg = $locales::params::update_locale_pkg, + Optional[String] $update_locale_cmd = $locales::params::update_locale_cmd, + Optional[String] $supported_locales = $locales::params::supported_locales, # ALL locales support + Boolean $manage_package = true, ) inherits locales::params { $locales.each | String $locale | { # expected format: "en_US.UTF-8UTF-8"