Extend parameter type validation coverage

... mainly using the common type definition from puppetlabs-stdlib.

Change-Id: I7c5c8cfda6f64b077b1077805ce5b64bdf357d50
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
Takashi Kajinami
2025-09-23 23:35:00 +09:00
parent 50bc841391
commit b0c245ccde
13 changed files with 79 additions and 73 deletions

View File

@@ -135,8 +135,8 @@
# Optional. String. Defaults to undef. # Optional. String. Defaults to undef.
# #
class ceph ( class ceph (
$fsid, String[1] $fsid,
$ensure = present, Stdlib::Ensure::Package $ensure = present,
Enum['cephx', 'none'] $authentication_type = 'cephx', Enum['cephx', 'none'] $authentication_type = 'cephx',
$keyring = undef, $keyring = undef,
$osd_journal_size = undef, $osd_journal_size = undef,

View File

@@ -75,8 +75,8 @@
# inferred from the client name. Default to undef. # inferred from the client name. Default to undef.
# #
define ceph::key ( define ceph::key (
$secret, String[1] $secret,
$cluster = undef, Optional[String[1]] $cluster = undef,
Stdlib::Absolutepath $keyring_path = "/etc/ceph/ceph.${name}.keyring", Stdlib::Absolutepath $keyring_path = "/etc/ceph/ceph.${name}.keyring",
$cap_mon = undef, $cap_mon = undef,
$cap_osd = undef, $cap_osd = undef,

View File

@@ -28,8 +28,8 @@
# Optional. Defaults to a empty hash. # Optional. Defaults to a empty hash.
# #
class ceph::keys ( class ceph::keys (
$args = {}, Hash $args = {},
$defaults = {}, Hash $defaults = {},
) { ) {
create_resources(ceph::key, $args, $defaults) create_resources(ceph::key, $args, $defaults)
} }

View File

@@ -51,16 +51,16 @@
# Optional. Default to 'ceph'. # Optional. Default to 'ceph'.
# #
class ceph::mds ( class ceph::mds (
$public_addr = undef, Optional[Stdlib::IP::Address] $public_addr = undef,
$pkg_mds = $ceph::params::pkg_mds, String[1] $pkg_mds = $ceph::params::pkg_mds,
$pkg_mds_ensure = present, Stdlib::Ensure::Package $pkg_mds_ensure = present,
Boolean $mds_activate = true, Boolean $mds_activate = true,
Optional[Stdlib::Absolutepath] $mds_data = undef, Optional[Stdlib::Absolutepath] $mds_data = undef,
$mds_enable = true, Boolean $mds_enable = true,
$mds_ensure = 'running', Stdlib::Ensure::Service $mds_ensure = 'running',
$mds_id = $facts['networking']['hostname'], String[1] $mds_id = $facts['networking']['hostname'],
$keyring = undef, Optional[String[1]] $keyring = undef,
$cluster = 'ceph', String[1] $cluster = 'ceph',
) inherits ceph::params { ) inherits ceph::params {
if $mds_data { if $mds_data {
$mds_data_real = $mds_data $mds_data_real = $mds_data

View File

@@ -45,11 +45,11 @@
# Optional. Defaults to false # Optional. Defaults to false
# #
define ceph::mgr ( define ceph::mgr (
$enable = true, Boolean $enable = true,
$ensure = running, Stdlib::Ensure::Service $ensure = running,
$cluster = 'ceph', String[1] $cluster = 'ceph',
Enum['cephx', 'none'] $authentication_type = 'cephx', Enum['cephx', 'none'] $authentication_type = 'cephx',
$key = undef, Optional[String[1]] $key = undef,
Boolean $inject_key = false, Boolean $inject_key = false,
) { ) {
file { "/var/lib/ceph/mgr/${cluster}-${name}": file { "/var/lib/ceph/mgr/${cluster}-${name}":

View File

@@ -31,9 +31,9 @@
# Optional. Default is true # Optional. Default is true
define ceph::mirror ( define ceph::mirror (
$pkg_mirror = 'rbd-mirror', String[1] $pkg_mirror = 'rbd-mirror',
$rbd_mirror_ensure = 'running', Stdlib::Ensure::Service $rbd_mirror_ensure = 'running',
$rbd_mirror_enable = true, Boolean $rbd_mirror_enable = true,
) { ) {
ensure_resource( 'package', ensure_resource( 'package',
$pkg_mirror, $pkg_mirror,

View File

@@ -59,12 +59,12 @@
# #
define ceph::mon ( define ceph::mon (
Enum['present', 'absent'] $ensure = present, Enum['present', 'absent'] $ensure = present,
$mon_enable = true, Boolean $mon_enable = true,
$public_addr = undef, Optional[Stdlib::IP::Address] $public_addr = undef,
$cluster = undef, Optional[String[1]] $cluster = undef,
Enum['cephx', 'none'] $authentication_type = 'cephx', Enum['cephx', 'none'] $authentication_type = 'cephx',
$key = undef, Optional[String[1]] $key = undef,
$keyring = undef, Optional[Stdlib::Absolutepath] $keyring = undef,
Optional[Float[0]] $exec_timeout = undef, Optional[Float[0]] $exec_timeout = undef,
) { ) {
include ceph::params include ceph::params

View File

@@ -28,8 +28,8 @@
# Optional. Defaults to a empty hash # Optional. Defaults to a empty hash
# #
class ceph::mons ( class ceph::mons (
$args = {}, Hash $args = {},
$defaults = {}, Hash $defaults = {},
) { ) {
create_resources(ceph::mon, $args, $defaults) create_resources(ceph::mon, $args, $defaults)
} }

View File

@@ -68,16 +68,16 @@
# #
define ceph::osd ( define ceph::osd (
Enum['present', 'absent'] $ensure = present, Enum['present', 'absent'] $ensure = present,
$journal = undef, Optional[String[1]] $journal = undef,
String[1] $cluster = 'ceph', String[1] $cluster = 'ceph',
$bluestore_wal = undef, Optional[String[1]] $bluestore_wal = undef,
$bluestore_db = undef, Optional[String[1]] $bluestore_db = undef,
Optional[Enum['filestore', 'bluestore']] $store_type = undef, Optional[Enum['filestore', 'bluestore']] $store_type = undef,
Optional[Float[0]] $exec_timeout = undef, Optional[Float[0]] $exec_timeout = undef,
$selinux_file_context = 'ceph_var_lib_t', String[1] $selinux_file_context = 'ceph_var_lib_t',
$fsid = undef, Optional[String[1]] $fsid = undef,
Boolean $dmcrypt = false, Boolean $dmcrypt = false,
$dmcrypt_key_dir = '/etc/ceph/dmcrypt-keys', Stdlib::Absolutepath $dmcrypt_key_dir = '/etc/ceph/dmcrypt-keys',
) { ) {
include ceph::params include ceph::params
$exec_timeout_real = $exec_timeout ? { $exec_timeout_real = $exec_timeout ? {

View File

@@ -36,10 +36,10 @@
# http://docs.ceph.com/docs/nautilus/rados/troubleshooting/troubleshooting-osd/ # http://docs.ceph.com/docs/nautilus/rados/troubleshooting/troubleshooting-osd/
# #
class ceph::osds ( class ceph::osds (
$args = {}, Hash $args = {},
$defaults = {}, Hash $defaults = {},
# DEPRECATED PARAMS # DEPRECATED PARAMS
$pid_max = undef, $pid_max = undef,
) { ) {
if $pid_max != undef { if $pid_max != undef {
warning('pid_max parameter is deprecated and has no effect.') warning('pid_max parameter is deprecated and has no effect.')

View File

@@ -57,14 +57,14 @@
# Optional. Defaults to undef. # Optional. Defaults to undef.
# #
class ceph::repo ( class ceph::repo (
$ensure = present, Enum['present', 'absent'] $ensure = present,
String[1] $release = $ceph::params::release, String[1] $release = $ceph::params::release,
$proxy = undef, $proxy = undef,
$proxy_username = undef, $proxy_username = undef,
$proxy_password = undef, $proxy_password = undef,
Boolean $enable_epel = true, Boolean $enable_epel = true,
Boolean $enable_sig = $ceph::params::enable_sig, Boolean $enable_sig = $ceph::params::enable_sig,
$ceph_mirror = undef, $ceph_mirror = undef,
) inherits ceph::params { ) inherits ceph::params {
case $facts['os']['family'] { case $facts['os']['family'] {
'Debian': { 'Debian': {

View File

@@ -28,6 +28,9 @@
# [*pkg_radosgw*] Package name for the ceph radosgw. # [*pkg_radosgw*] Package name for the ceph radosgw.
# Optional. Default is osfamily dependent (check ceph::params). # Optional. Default is osfamily dependent (check ceph::params).
# #
# [*pkg_radosgw_ensure*] Ensure status for the ceph radosgw package resources
# Optional. Defaults to present.
#
# [*rgw_ensure*] Whether to start radosgw service. # [*rgw_ensure*] Whether to start radosgw service.
# Optional. Default is running. # Optional. Default is running.
# #
@@ -88,25 +91,26 @@
# Optional. Default is false # Optional. Default is false
# #
define ceph::rgw ( define ceph::rgw (
$pkg_radosgw = undef, Optional[String[1]] $pkg_radosgw = undef,
$rgw_ensure = 'running', Stdlib::Ensure::Package $pkg_radosgw_ensure = present,
$rgw_enable = true, Stdlib::Ensure::Service $rgw_ensure = 'running',
$rgw_enable_apis = undef, Boolean $rgw_enable = true,
Stdlib::Absolutepath $rgw_data = "/var/lib/ceph/radosgw/ceph-${name}", $rgw_enable_apis = undef,
$user = undef, Stdlib::Absolutepath $rgw_data = "/var/lib/ceph/radosgw/ceph-${name}",
Stdlib::Absolutepath $keyring_path = "/etc/ceph/ceph.client.${name}.keyring", $user = undef,
Stdlib::Absolutepath $log_file = '/var/log/ceph/radosgw.log', Stdlib::Absolutepath $keyring_path = "/etc/ceph/ceph.client.${name}.keyring",
$rgw_dns_name = $facts['networking']['fqdn'], Stdlib::Absolutepath $log_file = '/var/log/ceph/radosgw.log',
$rgw_socket_path = undef, $rgw_dns_name = $facts['networking']['fqdn'],
$rgw_print_continue = false, $rgw_socket_path = undef,
$rgw_port = undef, Boolean $rgw_print_continue = false,
$frontend_type = 'civetweb', $rgw_port = undef,
$rgw_frontends = undef, Enum['beast', 'civetweb', 'apache-proxy-fcgi'] $frontend_type = 'civetweb',
$rgw_swift_url = "http://${facts['networking']['fqdn']}:7480", $rgw_frontends = undef,
$rgw_swift_url_prefix = 'swift', Stdlib::HTTPUrl $rgw_swift_url = "http://${facts['networking']['fqdn']}:7480",
$rgw_swift_account_in_url = false, String $rgw_swift_url_prefix = 'swift',
$rgw_swift_versioning_enabled = false, Boolean $rgw_swift_account_in_url = false,
$rgw_trust_forwarded_https = false, Boolean $rgw_swift_versioning_enabled = false,
Boolean $rgw_trust_forwarded_https = false,
) { ) {
unless $name =~ /^radosgw\..+/ { unless $name =~ /^radosgw\..+/ {
fail("Define name must be started with 'radosgw.'") fail("Define name must be started with 'radosgw.'")
@@ -138,11 +142,6 @@ define ceph::rgw (
} }
case $frontend_type { case $frontend_type {
'beast': {
ceph::rgw::beast { $name:
rgw_frontends => $rgw_frontends,
}
}
'civetweb': { 'civetweb': {
warning('civetweb frontend has been removed in quincy release.') warning('civetweb frontend has been removed in quincy release.')
ceph::rgw::civetweb { $name: ceph::rgw::civetweb { $name:
@@ -159,12 +158,15 @@ define ceph::rgw (
} }
} }
default: { default: {
fail("Unsupported frontend_type: ${frontend_type}") # beast
ceph::rgw::beast { $name:
rgw_frontends => $rgw_frontends,
}
} }
} }
stdlib::ensure_packages( $pkg_radosgw_real, { stdlib::ensure_packages( $pkg_radosgw_real, {
ensure => installed, ensure => $pkg_radosgw_ensure,
tag => 'ceph', tag => 'ceph',
}) })

View File

@@ -0,0 +1,4 @@
---
features:
- |
The new ``ceph::rgw::pkg_radosgw_ensure`` parameter has been added.