-
Notifications
You must be signed in to change notification settings - Fork 614
(CONT-361) Syntax update #1397
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
(CONT-361) Syntax update #1397
Conversation
399cfd7
to
5ae2e79
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great!
I tested these changes with onceover with our control-repo configuration to check for regressions and found a backward incompatible changes with the new validation.
The puppetlabs-puppetdb
module setup a postgresql::server::db
with grant => 'all'
(sic):
The puppetlabs-postgresql
module copy the value of the grant
parameter to the privilege
parameter of a postgresql::server::database_grant
defined type:
puppetlabs-postgresql/manifests/server/db.pp
Lines 47 to 51 in 5d62783
postgresql::server::database_grant { "GRANT ${user} - ${grant} - ${dbname}": | |
privilege => $grant, | |
db => $dbname, | |
role => $user, | |
} -> Postgresql_conn_validator<| db_name == $dbname |> |
The new code validates that privilege
parameter against the type Enum['ALL', 'CREATE', 'CONNECT', 'TEMPORARY', 'TEMP']
. The case does not match (Enum is case sensitive) and an error is reported:
errors:
Evaluation Error: Error while evaluating a Resource Statement, Postgresql::Server::Database_grant[GRANT puppetdb - all - puppetdb]: parameter 'privilege' expects a match for Enum['ALL', 'CONNECT', 'CREATE', 'TEMP', 'TEMPORARY'], got 'all'
file: modules/postgresql/manifests/server/db.pp
line: 47
factsets: Ubuntu-18.4-64
Evaluation Error: Error while evaluating a Resource Statement, Postgresql::Server::Database_grant[GRANT puppetdb - all - puppetdb]: parameter 'privilege' expects a match for Enum['ALL', 'CONNECT', 'CREATE', 'TEMP', 'TEMPORARY'], got 'all'
file: modules/postgresql/manifests/server/db.pp
line: 47
factsets: Debian-11-64
Evaluation Error: Error while evaluating a Resource Statement, Postgresql::Server::Database_grant[GRANT puppetdb - all - puppetdb]: parameter 'privilege' expects a match for Enum['ALL', 'CONNECT', 'CREATE', 'TEMP', 'TEMPORARY'], got 'all'
file: modules/postgresql/manifests/server/db.pp
line: 47
factsets: Debian-10-64
Evaluation Error: Error while evaluating a Resource Statement, Postgresql::Server::Database_grant[GRANT puppetdb - all - puppetdb]: parameter 'privilege' expects a match for Enum['ALL', 'CONNECT', 'CREATE', 'TEMP', 'TEMPORARY'], got 'all'
file: modules/postgresql/manifests/server/db.pp
line: 47
factsets: CentOS-7.6-64
Great work, this module has been missing data types for a long time! I added a few review comments. |
New commit. Have adjusted the PR to implement some suggestions. |
Optional[String[1]] $package_name = undef, | ||
Optional[String[1]] $post_script = undef, | ||
Optional[String[1]] $pre_script = undef, | ||
String[1] $dir, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll note I hate alignment on data types since it creates so much noise in the git log. The old style was much better IMHO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understandable. However, we are currently favouring a more 'readable' and structured style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't help code readability much, but it makes diffs harder to read and review. +1 for not doing alignment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd even argue it's less readable if you have a long type (like the version you wrote for the package ensure) there is a lot of whitespace, so it becomes hard to see which data types belong to which variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I find it best for when I have to search out a specific variable in the list, especially for larger modules that have upwards of a dozen.
I've always found it easier to track down that one that I'm looking for.
7e2f6ba
to
621f337
Compare
Code is now compliant with rules regarding: parameter datatypes
9278196
to
e522f51
Compare
This commit adds functionality to allow an array of $listen_addresses to be specified as a string containing a comma-seperated list of addresses, which was removed unintentioanlly in puppetlabs#1397. Fixes puppetlabs#1426.
Code is now compliant with rules regarding:
parameter datatypes
parameter documentation