From d6e92da5a5fb48006841068f117ba3ce55a126b1 Mon Sep 17 00:00:00 2001 From: Lennart Betz Date: Thu, 19 Oct 2023 16:50:34 +0200 Subject: [PATCH] Switch all db_type parameters to no defauts --- REFERENCE.md | 14 +++----------- manifests/init.pp | 4 ++-- manifests/module/director.pp | 2 +- manifests/module/icingadb.pp | 2 +- manifests/module/reporting.pp | 2 +- manifests/module/vspheredb.pp | 2 +- spec/classes/config_spec.rb | 12 ++++++------ spec/classes/director_service_spec.rb | 4 ++-- spec/classes/director_spec.rb | 4 +++- spec/classes/icingadb_spec.rb | 3 ++- spec/classes/monitoring_spec.rb | 2 +- spec/classes/vspheredb_service_spec.rb | 4 ++-- spec/classes/vspheredb_spec.rb | 3 ++- 13 files changed, 27 insertions(+), 31 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index e553d69b..7e43a49b 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -336,8 +336,6 @@ Data type: `Enum['mysql', 'pgsql']` Database type, can be either `mysql` or `pgsql`. -Default value: `'mysql'` - ##### `db_host` Data type: `Stdlib::Host` @@ -372,10 +370,12 @@ Default value: `'icingaweb2'` ##### `db_password` -Data type: `Icingaweb2::Secret` +Data type: `Optional[Icingaweb2::Secret]` Password for database access. +Default value: `undef` + ##### `use_tls` Data type: `Optional[Boolean]` @@ -1093,8 +1093,6 @@ Data type: `Enum['mysql', 'pgsql']` Type of your database. Either `mysql` or `pgsql`. -Default value: `'mysql'` - ##### `db_host` Data type: `Stdlib::Host` @@ -1895,8 +1893,6 @@ Data type: `Enum['mysql', 'pgsql']` Type of your IDO database. Either `mysql` or `pgsql`. -Default value: `'mysql'` - ##### `db_host` Data type: `Stdlib::Host` @@ -3040,8 +3036,6 @@ Data type: `Enum['mysql', 'pgsql']` The database type. Either mysql or postgres. -Default value: `'mysql'` - ##### `db_host` Data type: `Stdlib::Host` @@ -3377,8 +3371,6 @@ Data type: `Enum['mysql']` The database type. Either mysql or postgres. -Default value: `'mysql'` - ##### `db_host` Data type: `Stdlib::Host` diff --git a/manifests/init.pp b/manifests/init.pp index 3fa61f90..1281fbbf 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -209,7 +209,7 @@ Stdlib::Absolutepath $logging_file, String $conf_user, String $conf_group, - Icingaweb2::Secret $db_password, + Enum['mysql', 'pgsql'] $db_type, Variant[Icingaweb2::AdminRole, Boolean[false]] $admin_role, String $default_admin_username, Icingaweb2::Secret $default_admin_password, @@ -226,11 +226,11 @@ Boolean $manage_package = true, Optional[Array[String]] $extra_packages = undef, Variant[Boolean, Enum['mariadb', 'mysql']] $import_schema = false, - Enum['mysql', 'pgsql'] $db_type = 'mysql', Stdlib::Host $db_host = 'localhost', Optional[Stdlib::Port] $db_port = undef, String $db_name = 'icingaweb2', String $db_username = 'icingaweb2', + Optional[Icingaweb2::Secret] $db_password = undef, Optional[Boolean] $use_tls = undef, Optional[Stdlib::Absolutepath] $tls_key_file = undef, Optional[Stdlib::Absolutepath] $tls_cert_file = undef, diff --git a/manifests/module/director.pp b/manifests/module/director.pp index f0dd29bc..e11724d8 100644 --- a/manifests/module/director.pp +++ b/manifests/module/director.pp @@ -113,13 +113,13 @@ # } # class icingaweb2::module::director ( + Enum['mysql', 'pgsql'] $db_type, Enum['absent', 'present'] $ensure = 'present', Optional[Stdlib::Absolutepath] $module_dir = undef, String $git_repository = 'https://github.com/Icinga/icingaweb2-module-director.git', Optional[String] $git_revision = undef, Enum['git', 'package', 'none'] $install_method = 'git', String $package_name = 'icingaweb2-module-director', - Enum['mysql', 'pgsql'] $db_type = 'mysql', Stdlib::Host $db_host = 'localhost', Optional[Stdlib::Port] $db_port = undef, String $db_name = 'director', diff --git a/manifests/module/icingadb.pp b/manifests/module/icingadb.pp index c3d21903..28415ff3 100644 --- a/manifests/module/icingadb.pp +++ b/manifests/module/icingadb.pp @@ -117,9 +117,9 @@ # class icingaweb2::module::icingadb ( String $package_name, + Enum['mysql', 'pgsql'] $db_type, Icingaweb2::Secret $db_password, Enum['absent', 'present'] $ensure = 'present', - Enum['mysql', 'pgsql'] $db_type = 'mysql', Stdlib::Host $db_host = 'localhost', Optional[Stdlib::Port] $db_port = undef, String $db_name = 'icingadb', diff --git a/manifests/module/reporting.pp b/manifests/module/reporting.pp index 0f8fe903..132cf424 100644 --- a/manifests/module/reporting.pp +++ b/manifests/module/reporting.pp @@ -94,9 +94,9 @@ Enum['git', 'none', 'package'] $install_method, String $git_repository, String $package_name, + Enum['mysql', 'pgsql'] $db_type, Optional[Stdlib::Absolutepath] $module_dir = undef, Optional[String] $git_revision = undef, - Enum['mysql', 'pgsql'] $db_type = 'mysql', Stdlib::Host $db_host = 'localhost', Optional[Stdlib::Port] $db_port = undef, String $db_name = 'reporting', diff --git a/manifests/module/vspheredb.pp b/manifests/module/vspheredb.pp index e5067577..12cedc64 100644 --- a/manifests/module/vspheredb.pp +++ b/manifests/module/vspheredb.pp @@ -87,13 +87,13 @@ # } # class icingaweb2::module::vspheredb ( + Enum['mysql'] $db_type, Enum['absent', 'present'] $ensure = 'present', Optional[Stdlib::Absolutepath] $module_dir = undef, String $git_repository = 'https://github.com/Icinga/icingaweb2-module-vspheredb.git', Optional[String] $git_revision = undef, Enum['git', 'none', 'package'] $install_method = 'git', String $package_name = 'icingaweb2-module-vspheredb', - Enum['mysql'] $db_type = 'mysql', Stdlib::Host $db_host = 'localhost', Optional[Stdlib::Port] $db_port = undef, String $db_name = 'vspheredb', diff --git a/spec/classes/config_spec.rb b/spec/classes/config_spec.rb index c54b1b9a..95458c8c 100644 --- a/spec/classes/config_spec.rb +++ b/spec/classes/config_spec.rb @@ -9,7 +9,7 @@ context 'with default parameters, db_type => mysql' do let :pre_condition do - "class { 'icingaweb2': db_type => 'mysql', db_password => 'secret' }" + "class { 'icingaweb2': db_type => 'mysql' }" end it { is_expected.to contain_icingaweb2__inisection('config-logging') } @@ -28,7 +28,7 @@ context 'with db_type => mysql, import_schema => true' do let :pre_condition do - "class { 'icingaweb2': import_schema => true, db_type => 'mysql', db_password => 'secret' }" + "class { 'icingaweb2': import_schema => true, db_type => 'mysql' }" end it { is_expected.to contain_icingaweb2__resource__database('mysql-icingaweb2') } @@ -40,7 +40,7 @@ context 'with db_type => pgsql, import_schema => true' do let :pre_condition do - "class { 'icingaweb2': import_schema => true, db_type => 'pgsql', db_password => 'secret' }" + "class { 'icingaweb2': import_schema => true, db_type => 'pgsql' }" end it { is_expected.to contain_icingaweb2__resource__database('pgsql-icingaweb2') } @@ -52,7 +52,7 @@ context 'with invalid db_type' do let :pre_condition do - "class { 'icingaweb2': db_type => 'foobar', db_password => 'secret' }" + "class { 'icingaweb2': db_type => 'foobar' }" end it { is_expected.to raise_error(Puppet::Error, %r{expects a match for Enum\['mysql', 'pgsql'\]}) } @@ -60,7 +60,7 @@ context 'with import_schema => true and admin_role => false' do let :pre_condition do - "class { 'icingaweb2': import_schema => true, db_type => 'mysql', db_password => 'secret', admin_role => false }" + "class { 'icingaweb2': import_schema => true, db_type => 'mysql', admin_role => false }" end it { is_expected.not_to contain_icingaweb2__config__role('default admin user') } @@ -68,7 +68,7 @@ context 'with cookie_path => /' do let :pre_condition do - "class { 'icingaweb2': cookie_path => '/', db_type => 'mysql', db_password => 'secret' }" + "class { 'icingaweb2': cookie_path => '/', db_type => 'mysql' }" end it { diff --git a/spec/classes/director_service_spec.rb b/spec/classes/director_service_spec.rb index 0a6f1107..d898dc67 100644 --- a/spec/classes/director_service_spec.rb +++ b/spec/classes/director_service_spec.rb @@ -3,8 +3,8 @@ describe('icingaweb2::module::director::service', type: :class) do let(:pre_condition) do [ - "class { 'icingaweb2': db_type => 'mysql', db_password => 'secret' }", - "class { 'icingaweb2::module::director': }", + "class { 'icingaweb2': db_type => 'mysql' }", + "class { 'icingaweb2::module::director': db_type => 'mysql' }", ] end diff --git a/spec/classes/director_spec.rb b/spec/classes/director_spec.rb index 8b51aa28..203a6ed5 100644 --- a/spec/classes/director_spec.rb +++ b/spec/classes/director_spec.rb @@ -3,7 +3,7 @@ describe('icingaweb2::module::director', type: :class) do let(:pre_condition) do [ - "class { 'icingaweb2': db_type => 'mysql', db_password => 'secret' }", + "class { 'icingaweb2': db_type => 'mysql' }", ] end @@ -16,6 +16,7 @@ context "#{os} with kickstart 'true'" do let(:params) do { git_revision: 'foobar', + db_type: 'mysql', db_host: 'localhost', db_name: 'director', db_username: 'director', @@ -69,6 +70,7 @@ context "#{os} with import_schema 'false'" do let(:params) do { git_revision: 'foobar', + db_type: 'mysql', db_host: 'localhost', db_name: 'director', db_username: 'director', diff --git a/spec/classes/icingadb_spec.rb b/spec/classes/icingadb_spec.rb index 132761a7..4ea6619f 100644 --- a/spec/classes/icingadb_spec.rb +++ b/spec/classes/icingadb_spec.rb @@ -3,7 +3,7 @@ describe('icingaweb2::module::icingadb', type: :class) do let(:pre_condition) do [ - "class { 'icingaweb2': db_type => 'mysql', db_password => 'secret' }", + "class { 'icingaweb2': db_type => 'mysql' }", ] end @@ -16,6 +16,7 @@ context "#{os} with local MySQL and Redis" do let(:params) do { + db_type: 'mysql', db_password: 'foobar', } end diff --git a/spec/classes/monitoring_spec.rb b/spec/classes/monitoring_spec.rb index 995ef909..45f4d74d 100644 --- a/spec/classes/monitoring_spec.rb +++ b/spec/classes/monitoring_spec.rb @@ -3,7 +3,7 @@ describe('icingaweb2::module::monitoring', type: :class) do let(:pre_condition) do [ - "class { 'icingaweb2': db_type => 'mysql', db_password => 'secret' }", + "class { 'icingaweb2': db_type => 'mysql' }", ] end diff --git a/spec/classes/vspheredb_service_spec.rb b/spec/classes/vspheredb_service_spec.rb index 63dbf530..df585aa7 100644 --- a/spec/classes/vspheredb_service_spec.rb +++ b/spec/classes/vspheredb_service_spec.rb @@ -3,8 +3,8 @@ describe('icingaweb2::module::vspheredb::service', type: :class) do let(:pre_condition) do [ - "class { 'icingaweb2': db_type => 'mysql', db_password => 'secret' }", - "class { 'icingaweb2::module::vspheredb': }", + "class { 'icingaweb2': db_type => 'mysql' }", + "class { 'icingaweb2::module::vspheredb': db_type => 'mysql' }", ] end diff --git a/spec/classes/vspheredb_spec.rb b/spec/classes/vspheredb_spec.rb index d376091d..59449cea 100644 --- a/spec/classes/vspheredb_spec.rb +++ b/spec/classes/vspheredb_spec.rb @@ -3,7 +3,7 @@ describe('icingaweb2::module::vspheredb', type: :class) do let(:pre_condition) do [ - "class { 'icingaweb2': db_type => 'mysql', db_password => 'secret' }", + "class { 'icingaweb2': db_type => 'mysql' }", ] end @@ -16,6 +16,7 @@ context "#{os} with git_revision 'v1.1.0'" do let(:params) do { git_revision: 'v1.1.0', + db_type: 'mysql', db_host: 'localhost', db_name: 'vspheredb', db_username: 'vspheredb',