From 843fa12939db665512a8d5ce667907dc47049a84 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 20 Jul 2023 11:06:14 +0900 Subject: [PATCH] Validate authentication_type Currently we expect only 'cephx' or 'none' as authentication_type. This enforces that limitation using parameter types.. Change-Id: I9d783e500f94b3f474d657ab10b1594ab6e6e65b --- manifests/init.pp | 66 ++++++++++++------------ manifests/mgr.pp | 12 ++--- manifests/mon.pp | 2 +- manifests/profile/params.pp | 2 +- spec/classes/ceph_profile_client_spec.rb | 2 +- 5 files changed, 42 insertions(+), 42 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 2f421c1d..d2218906 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -142,40 +142,40 @@ # class ceph ( $fsid, - $ensure = present, - $authentication_type = 'cephx', - $keyring = undef, - $osd_journal_size = undef, - $osd_max_object_name_len = undef, - $osd_max_object_namespace_len = undef, - $osd_pool_default_pg_num = undef, - $osd_pool_default_pgp_num = undef, - $osd_pool_default_size = undef, - $osd_pool_default_min_size = undef, - $osd_pool_default_crush_rule = undef, - $osd_crush_update_on_start = undef, - $mon_osd_full_ratio = undef, - $mon_osd_nearfull_ratio = undef, - $mon_initial_members = undef, - $mon_host = undef, - $ms_bind_ipv4 = undef, - $ms_bind_ipv6 = undef, - $require_signatures = undef, - $cluster_require_signatures = undef, - $service_require_signatures = undef, - $sign_messages = undef, - $cluster_network = undef, - $public_network = undef, - $public_addr = undef, - $osd_max_backfills = undef, - $osd_recovery_max_active = undef, - $osd_recovery_op_priority = undef, - $osd_recovery_max_single_start = undef, - $osd_max_scrubs = undef, - $osd_op_threads = undef, - $rbd_default_features = undef, + $ensure = present, + Enum['cephx', 'none'] $authentication_type = 'cephx', + $keyring = undef, + $osd_journal_size = undef, + $osd_max_object_name_len = undef, + $osd_max_object_namespace_len = undef, + $osd_pool_default_pg_num = undef, + $osd_pool_default_pgp_num = undef, + $osd_pool_default_size = undef, + $osd_pool_default_min_size = undef, + $osd_pool_default_crush_rule = undef, + $osd_crush_update_on_start = undef, + $mon_osd_full_ratio = undef, + $mon_osd_nearfull_ratio = undef, + $mon_initial_members = undef, + $mon_host = undef, + $ms_bind_ipv4 = undef, + $ms_bind_ipv6 = undef, + $require_signatures = undef, + $cluster_require_signatures = undef, + $service_require_signatures = undef, + $sign_messages = undef, + $cluster_network = undef, + $public_network = undef, + $public_addr = undef, + $osd_max_backfills = undef, + $osd_recovery_max_active = undef, + $osd_recovery_op_priority = undef, + $osd_recovery_max_single_start = undef, + $osd_max_scrubs = undef, + $osd_op_threads = undef, + $rbd_default_features = undef, # DEPRECATED PARAMETERS - $set_osd_params = false, + $set_osd_params = false, ) { include ceph::params diff --git a/manifests/mgr.pp b/manifests/mgr.pp index 18e0a229..30461384 100644 --- a/manifests/mgr.pp +++ b/manifests/mgr.pp @@ -45,12 +45,12 @@ # Optional. Defaults to false # define ceph::mgr ( - $enable = true, - $ensure = running, - $cluster = 'ceph', - $authentication_type = 'cephx', - $key = undef, - Boolean $inject_key = false, + $enable = true, + $ensure = running, + $cluster = 'ceph', + Enum['cephx', 'none'] $authentication_type = 'cephx', + $key = undef, + Boolean $inject_key = false, ) { file { '/var/lib/ceph/mgr': ensure => directory, diff --git a/manifests/mon.pp b/manifests/mon.pp index 79956730..8c19e395 100644 --- a/manifests/mon.pp +++ b/manifests/mon.pp @@ -62,7 +62,7 @@ define ceph::mon ( $mon_enable = true, $public_addr = undef, $cluster = undef, - $authentication_type = 'cephx', + Enum['cephx', 'none'] $authentication_type = 'cephx', $key = undef, $keyring = undef, $exec_timeout = $ceph::params::exec_timeout, diff --git a/manifests/profile/params.pp b/manifests/profile/params.pp index 15313a5c..21eb3e62 100644 --- a/manifests/profile/params.pp +++ b/manifests/profile/params.pp @@ -185,7 +185,7 @@ class ceph::profile::params ( $fsid = undef, $release = undef, - $authentication_type = undef, + Optional[Enum['cephx', 'none']] $authentication_type = undef, $mon_initial_members = undef, $mon_host = undef, $ms_bind_ipv4 = undef, diff --git a/spec/classes/ceph_profile_client_spec.rb b/spec/classes/ceph_profile_client_spec.rb index 8a53a677..0a77aae3 100644 --- a/spec/classes/ceph_profile_client_spec.rb +++ b/spec/classes/ceph_profile_client_spec.rb @@ -79,7 +79,7 @@ describe 'ceph::profile::client' do context 'without cephx and client_keys' do let :pre_condition do "class { 'ceph::profile::params': - authentication_type => 'undef', + authentication_type => 'none', client_keys => {} }" end