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

Set data types for puppetdb parameters #411

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

chambersmp
Copy link
Contributor

@chambersmp chambersmp commented May 29, 2024

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:

  • Data types have been added to the parameters for both classes and defined types
  • Stdlib types provide validation for complex inputs (e.g. Stdlib::Host, Stdlib::Port::User)
  • Data values supplied by unit and acceptance tests were reviewed to ensure parameters supported expected input value types
  • Unit test param inputs refined to support expected data types.

Potential for Breaking Change:

  • Data type validation may render some user inputs invalid (i.e. Strings provided where Integer expected).
  • To guard against this some parameters use Variant to support historical String usage with Pattern matching

Related Issues:
resolves #105

Testing:

  • Mend tests are expected to fail on forked repositories due to missing secrets.
  • All CI tests (unit and acceptance) are passing.

@chambersmp chambersmp marked this pull request as draft May 29, 2024 05:57
@chambersmp chambersmp marked this pull request as ready for review June 7, 2024 02:11
manifests/database/default_read_grant.pp Outdated Show resolved Hide resolved
manifests/database/postgresql_ssl_rules.pp Outdated Show resolved Hide resolved
manifests/database/postgresql_ssl_rules.pp Outdated Show resolved Hide resolved
manifests/database/read_grant.pp Outdated Show resolved Hide resolved
manifests/master/config.pp Outdated Show resolved Hide resolved
manifests/server/validate_db.pp Outdated Show resolved Hide resolved
manifests/server/validate_read_db.pp Outdated Show resolved Hide resolved
@h0tw1r3
Copy link
Contributor

h0tw1r3 commented Jun 11, 2024

FWIW, I would remove the maintenance label so the change does show up in the change log and release notes.

manifests/init.pp Outdated Show resolved Hide resolved
@chambersmp
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Manifest should validate the passed parameters
4 participants