-
-
Notifications
You must be signed in to change notification settings - Fork 881
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
Minor refactor of mailhost.pp #1397
Conversation
nginx::resource::mailhost is a typethat may have no external impact to Forge modules. This module is declared in 11 of 575 indexed public
|
@@ -1,7 +1,5 @@ | |||
# define: nginx::resource::mailhost | |||
# | |||
# This definition creates a virtual host |
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.
No it doesn't...
manifests/resource/mailhost.pp
Outdated
@@ -122,22 +120,10 @@ | |||
String $proxy_pass_error_message = 'off', | |||
Array $server_name = [$name] | |||
) { | |||
|
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 think the new whitespace lint plugin complains about this line
if ! defined(Class['nginx']) { | ||
fail('You must include the nginx base class before using any defined resources') | ||
} | ||
|
||
$root_group = $nginx::root_group |
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.
No need to create a local variable here.
if ! defined(Class['nginx']) { | ||
fail('You must include the nginx base class before using any defined resources') | ||
} | ||
|
||
$root_group = $nginx::root_group | ||
|
||
File { |
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.
There are no File
resources in this manifest (and resource defaults like this are discouraged anyway)
mode => $nginx::global_mode, | ||
} | ||
|
||
$config_dir = "${nginx::conf_dir}/conf.mail.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.
Moved these lines to after the other validation stuff.
8418c11
to
760f45e
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.
I noticed similar things but held back refactoring :)
@@ -77,13 +75,13 @@ | |||
# } | |||
# | |||
define nginx::resource::mailhost ( | |||
Integer $listen_port, | |||
Stdlib::Port $listen_port, |
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.
Since these are ports, you can drop the + 0
later on in the code. That used to be needed when it could have been a String.
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.
Done!
@@ -77,13 +75,13 @@ | |||
# } | |||
# | |||
define nginx::resource::mailhost ( | |||
Integer $listen_port, | |||
Stdlib::Port $listen_port, | |||
Enum['absent', 'present'] $ensure = 'present', | |||
Variant[Array[String], String] $listen_ip = '*', | |||
Optional[String] $listen_options = undef, | |||
Boolean $ipv6_enable = false, | |||
Variant[Array[String], String] $ipv6_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.
I don't know if this should also be tightened. Not sure about the nginx spec for listening.
760f45e
to
1319e15
Compare
@@ -169,7 +158,7 @@ | |||
} | |||
|
|||
# Create SSL File Stubs if SSL is enabled | |||
if ($ssl) { | |||
if $ssl { |
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.
If you're removing these braces, do we also remove them around line 143?
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.
Dear @alexjfisher, thanks for the PR! This is Vox Pupuli Tasks, your friendly Vox Pupuli Github Bot. I noticed that your pull request has CI failures. Can you please have a look at the failing CI jobs? |
1319e15
to
aeea592
Compare
* Remove what looks like copy-n-pasted lines (copied from resource/server.pp ?) * Use `Stdlib::Port` instead of `Integer` * Get rid of unneeded `+ 0` (which was needed to cast String's to Integers)
aeea592
to
9a2b890
Compare
Minor refactor of mailhost.pp
Stdlib::Port
instead ofInteger