Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch all db_type parameters to no defauts #377

Merged
merged 1 commit into from Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 3 additions & 11 deletions REFERENCE.md
Expand Up @@ -336,8 +336,6 @@ Data type: `Enum['mysql', 'pgsql']`

Database type, can be either `mysql` or `pgsql`.

Default value: `'mysql'`

##### <a name="-icingaweb2--db_host"></a>`db_host`

Data type: `Stdlib::Host`
Expand Down Expand Up @@ -372,10 +370,12 @@ Default value: `'icingaweb2'`

##### <a name="-icingaweb2--db_password"></a>`db_password`

Data type: `Icingaweb2::Secret`
Data type: `Optional[Icingaweb2::Secret]`

Password for database access.

Default value: `undef`

##### <a name="-icingaweb2--use_tls"></a>`use_tls`

Data type: `Optional[Boolean]`
Expand Down Expand Up @@ -1093,8 +1093,6 @@ Data type: `Enum['mysql', 'pgsql']`

Type of your database. Either `mysql` or `pgsql`.

Default value: `'mysql'`

##### <a name="-icingaweb2--module--director--db_host"></a>`db_host`

Data type: `Stdlib::Host`
Expand Down Expand Up @@ -1895,8 +1893,6 @@ Data type: `Enum['mysql', 'pgsql']`

Type of your IDO database. Either `mysql` or `pgsql`.

Default value: `'mysql'`

##### <a name="-icingaweb2--module--icingadb--db_host"></a>`db_host`

Data type: `Stdlib::Host`
Expand Down Expand Up @@ -3040,8 +3036,6 @@ Data type: `Enum['mysql', 'pgsql']`

The database type. Either mysql or postgres.

Default value: `'mysql'`

##### <a name="-icingaweb2--module--reporting--db_host"></a>`db_host`

Data type: `Stdlib::Host`
Expand Down Expand Up @@ -3377,8 +3371,6 @@ Data type: `Enum['mysql']`

The database type. Either mysql or postgres.

Default value: `'mysql'`

##### <a name="-icingaweb2--module--vspheredb--db_host"></a>`db_host`

Data type: `Stdlib::Host`
Expand Down
4 changes: 2 additions & 2 deletions manifests/init.pp
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion manifests/module/director.pp
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion manifests/module/icingadb.pp
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion manifests/module/reporting.pp
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion manifests/module/vspheredb.pp
Expand Up @@ -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',
Expand Down
12 changes: 6 additions & 6 deletions spec/classes/config_spec.rb
Expand Up @@ -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') }
Expand All @@ -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') }
Expand All @@ -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') }
Expand All @@ -52,23 +52,23 @@

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'\]}) }
end

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') }
end

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 {
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/director_service_spec.rb
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion spec/classes/director_spec.rb
Expand Up @@ -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

Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion spec/classes/icingadb_spec.rb
Expand Up @@ -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

Expand All @@ -16,6 +16,7 @@
context "#{os} with local MySQL and Redis" do
let(:params) do
{
db_type: 'mysql',
db_password: 'foobar',
}
end
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/monitoring_spec.rb
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions spec/classes/vspheredb_service_spec.rb
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion spec/classes/vspheredb_spec.rb
Expand Up @@ -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

Expand All @@ -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',
Expand Down