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

Fix $openldap::server::database data type #329

Merged
merged 1 commit into from
Sep 22, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/puppet/type/openldap_database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def should_to_s(_newvalue)
end

newparam(:initdb, boolean: true) do
desc 'When true it initiales the database with the top object. When false, it does not create any object in the database, so you have to create it by other mechanism. It defaults to true'
desc 'When true it initiales the database with the top object. When false, it does not create any object in the database, so you have to create it by other mechanism. It defaults to false when the backend is one of config, ldap, monitor or relay, true otherwise.'

newvalues(:true, :false)
defaultto do
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/database.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Optional[String[1]] $backend = undef,
Optional[String[1]] $rootdn = undef,
Optional[String[1]] $rootpw = undef,
Optional[String[1]] $initdb = undef,
Optional[Boolean] $initdb = undef,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find Optional strange for Booleans, because isn't undef equivalent to false? Seems like the default is true in the type. Maybe remove Optional and default it to true?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is indeed over-complicated and I was trying to decipher this.
Defaulting to true should be the right thing to do.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to reverse this because the default value actually depend on the backend.

Boolean $readonly = false,
Optional[String[1]] $sizelimit = undef,
Optional[String[1]] $dbmaxsize = undef,
Expand Down