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.
#
class ceph (
$fsid,
$ensure = present,
String[1] $fsid,
Stdlib::Ensure::Package $ensure = present,
Enum['cephx', 'none'] $authentication_type = 'cephx',
$keyring = undef,
$osd_journal_size = undef,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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