-
-
Notifications
You must be signed in to change notification settings - Fork 882
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
Add stricter parameter types #1413
base: master
Are you sure you want to change the base?
Conversation
653f455
to
fc7be3c
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.
👀
manifests/init.pp
Outdated
$service_restart = undef, | ||
$service_name = 'nginx', | ||
$service_manage = true, | ||
Enum['running', 'absent', 'stopped', 'undef'] $service_ensure = running, |
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.
what's undef doing here?
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.
Copied from the previous PR. Haven't looked too closely at the content yet.
manifests/service.pp
Outdated
$service_flags = $nginx::service_flags, | ||
$service_manage = $nginx::service_manage, | ||
Optional[String[1]] $service_restart = $nginx::service_restart, | ||
Enum['running', 'absent', 'stopped', 'undef'] $service_ensure = $nginx::service_ensure, |
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.
what's undef doing here?
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.
In #1414 I chose Stdlib::Ensure::Service
fc7be3c
to
5183608
Compare
#1414 should probably be merged first. |
manifests/resource/mailhost.pp
Outdated
String $proxy_pass_error_message = 'off', | ||
Array $server_name = [$name] | ||
Enum['absent', 'present'] $ensure = 'present', | ||
Variant[Enum['*'], Array[Stdlib::Ipv4], Stdlib::Ipv4] $listen_ip = '*', |
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.
These should be Stdlib::IP::Address::V4::Nosubnet
. Same below for IPv4
b4ad1dd
to
726aaa8
Compare
Converting to draft since I'm using Travis instead of local tests. Feel free to point out errors or mistakes, but no need to approve until it's green. |
726aaa8
to
74b6f38
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.
🙋🏻♀️
types/duration.pp
Outdated
@@ -0,0 +1 @@ | |||
type Nginx::Duration = Pattern[/^((\d+y)?\s?(\d+M)?\s?(\d+w)?\s?(\d+d)?\s?(\d+h)?\s?(\d+m)?\s?(\d+s)?\s?(\d+ms)?\s?|\d+)$/] |
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.
why is there a trailing \s?
?
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.
diffing this regex with the stricter pattern that's Nginx::Time
is still on my todo list.
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 added a commit that merges it into Nginx::Time. That also copies the Nginx docs. While it now allows a lot of additional whitespace, it's probably easier to read this way. The various suffixes can be combined and I can't see how the regex can be really improved.
74b6f38
to
aa2df02
Compare
Note to self:
|
This includes a rebase of #1189. That adds a type Nginx::Duration which looks similar to Nginx::Time (added in f0bf83a). We likely want to unify those, but right now I'm not sharp enough to see the exact differences.