-
Notifications
You must be signed in to change notification settings - Fork 580
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
Rewrite validate_domain_name() as a Puppet 4.x function #1345
Conversation
validate_domain_name is a functionthat may have no external impact to Forge modules. validate_domain_name is a functionthat may have no external impact to Forge modules. This module is declared in 318 of 580 indexed public
|
5d200e2
to
0d72dcf
Compare
@@ -5,7 +5,6 @@ | |||
describe 'validate_domain_name' do | |||
describe 'signature validation' do | |||
it { is_expected.not_to eq(nil) } | |||
it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) } |
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 is a change: before calling the function without parameters caused an exception, but now it pass (I would have assumed repeated_param
was one or more but it seems to allow 0 values).
While we can add some code to make match the old behavior, it seems overkill and I decided to just ignore this corner case.
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 addressed this in #1351.
0d72dcf
to
c6e36f1
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.
LGTM excluding the namespacing comments
c6e36f1
to
66b5c19
Compare
66b5c19
to
4a0b112
Compare
The 3.x function rely on is_domain_name() which is deprecated. Rewrite it using the more modern puppet 4.x function to rely on data types for better parameters validation. While here, adjust the Stdlib::Fqdn / Stdlib::Host data types to test fully numerical addresses and add a Stdlib::Dns::Zonedata type that is basically the same but with a trailing dot.
4a0b112
to
c76f505
Compare
I just realized the PR description and the commit message where not in sync with the updated code. I force-pushed to fix the commit message. Sorry for the inconvenience! |
In #1345, the validate_domain_name() function was rewritten to the Puppet 4.x syntax, but the behaviour was slightly changed since we previously did not allow passing no parameter at all. Add code to assert as least one paramatter is passed to restore the previous behavior and raise an error when called without parameter.
The 3.x function rely on
is_domain_name()
which is deprecated. Rewrite it using the more modern puppet 4.x function to rely on data types for better parameters validation.While here, adjust the
Stdlib::Fqdn
/Stdlib::Host
data types to test fully numerical addresses and add aStdlib::Dns::Zone
data type that is basically the same but with a trailing dot.