-
Notifications
You must be signed in to change notification settings - Fork 236
Set data types for puppetdb parameters #411
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
Conversation
FWIW, I would remove the maintenance label so the change does show up in the change log and release notes.
As open_ssl_listen_port is no longer optional both params.pp and the unit test shared-examples have been updated to default to false instead of undef|nil.
is there any blocker in getting this PR merged now that's approved?
is there any blocker in getting this PR merged now that's approved?
Should be good to go, I haven't had a chance to test on live node so I haven't merged. Passing all unit tests.
zaben903
commented
Oct 16, 2025
Tested changes with a development environment Puppetserver.
Confirmed invalid data such as the example from #105 will return a compile time error.
class { 'puppetdb': listen_port => 'localhost', }
$ puppet agent -t
Info: Using environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Notice: Requesting catalog from puppet:8140 (127.0.0.1)
Notice: Catalog compiled by puppet-testing
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Class[Puppetdb]: parameter 'listen_port' expects a value of type Stdlib::Port::User = Integer[1024, 49151] or Pattern[/\A[0-9]+\Z/], got String (file: /etc/puppet/code/environments/production/manifests/site.pp, line: 32, column: 3) on node puppet-testing
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
When data is valid, this module works as expected compiling and implementing changes.
Confirmed working with Strings and Integers with pattern matching (where used).
class { 'puppetdb': ssl_listen_port => 8000, # or '8000' } class { 'puppetdb::master::config': puppetdb_port => 8000, # or '8000' }
puppet agent -t
Info: Using environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Notice: Requesting catalog from puppet:8140 (127.0.0.1)
Notice: Catalog compiled by puppet-testing
Info: Caching catalog for puppet-testing
Info: Applying configuration version '1760595330'
Notice: /Stage[main]/Puppetdb::Server::Jetty/Ini_setting[puppetdb_sslport]/value: value changed 8081 to 8000
Info: Class[Puppetdb::Server::Jetty]: Scheduling refresh of Service[puppetdb]
Notice: /Stage[main]/Puppetdb::Server/Service[puppetdb]: Triggered 'refresh' from 1 event
Notice: /Stage[main]/Puppetdb::Master::Puppetdb_conf/Ini_setting[puppetdbserver_urls]/value: value changed https://puppet-testing:8081/ to https://puppet-testing:8000/
Info: Class[Puppetdb::Master::Puppetdb_conf]: Scheduling refresh of Service[puppetserver]
Notice: /Stage[main]/Puppetdb::Master::Config/Service[puppetserver]: Triggered 'refresh' from 1 event
Notice: Applied catalog in 43.43 seconds
Uh oh!
There was an error while loading. Please reload this page.
Summary:
Enable data type validation for parameters in puppetdb classes and defined types. The goal is to refine user inputs to reduce risk of misconfiguration or failure to apply.
Each data type was configured based on default values supplied within the params.pp class, unit/acceptance tests and alternative values recommended in PuppetDB docs.
Changes:
Stdlib::Host,Stdlib::Port::User)Potential for Breaking Change:
Variantto support historicalStringusage withPatternmatchingRelated Issues:
resolves #105
Testing: