-
-
Notifications
You must be signed in to change notification settings - Fork 54
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 refresh_pattern defined type #57
Conversation
README.md
Outdated
|
||
#### Parameters for Type squid::refresh_pattern | ||
* `case_sensitive` Boolean value, if true (default) the regex is case sensitive, when false the case insensitive flag '-i' is added to the pattern | ||
* `comment` Comment added before refresh rule, defaults to refresh_pattern fragement for `title` |
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.
'fragement' spelling
manifests/init.pp
Outdated
@@ -77,6 +78,9 @@ | |||
if $cache_dirs { | |||
validate_hash($cache_dirs) | |||
} | |||
if $refresh_patterns { | |||
validate_hash($refresh_patterns) |
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.
Vox Pupuli are (slowly) getting round to replacing all calls to validate_x with puppet 4 data types.
manifests/refresh_pattern.pp
Outdated
$pattern = $title, | ||
$comment = "refresh_pattern fragment for ${pattern}", | ||
) { | ||
validate_bool($case_sensitive) |
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.
Can you use puppet 4 data types instead of validate_x calls here?
manifests/init.pp
Outdated
$sslproxy_cert_error = $squid::params::sslproxy_cert_error, | ||
$extra_config_sections = {}, | ||
String $access_log = $squid::params::access_log, | ||
String $cache_mem = $squid::params::cache_mem, |
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 should be possible to do something like
Pattern[/\d+ MB/] $cache_mem = $squid::params::cache_mem
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.
I'll have a look at adding the pattern to the parameter definition
@alexjfisher Added Pattern to params to replace the last couple of validate_re calls and updated memory_cache_shared to accept on/off or boolean value. |
templates/squid.conf.header.erb
Outdated
@@ -5,7 +5,7 @@ | |||
cache_mem <%= @cache_mem %> | |||
|
|||
<% if @memory_cache_shared -%> |
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 problem if the parameter has been set to the boolean false
. Instead of memory_cache_shared 'off'
you'll get nothing.
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.
Maybe this would need to be...
<% unless @memory_cache_shared.nil? -%>
??
Probably need a new spec test if you're going to include this change in this PR. Alternatively, it can be left as just a 'yes'/'no' Enum for now and someone could tackle accepting booleans in a separate PR.
templates/squid.conf.header.erb
Outdated
@@ -5,7 +5,7 @@ | |||
cache_mem <%= @cache_mem %> | |||
|
|||
<% if @memory_cache_shared -%> |
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.
Maybe this would need to be...
<% unless @memory_cache_shared.nil? -%>
??
Probably need a new spec test if you're going to include this change in this PR. Alternatively, it can be left as just a 'yes'/'no' Enum for now and someone could tackle accepting booleans in a separate PR.
@alexjfisher I was wondering about that check in the template. I'll update with .nil and see if it still works as expected. |
@alexjfisher puppet-squid/spec/classes/init_spec.rb Line 66 in 3daf11d
puppet-squid/spec/classes/init_spec.rb Line 88 in 3daf11d
|
Replaced untyped parameters in init.pp and refresh_pattern.pp with Puppet4 data types and removed validate_x function calls Allow on / off string and boolean value for memory_cache_shared
Merged. Thanks @matonb ! |
Adds a defined type for Squid refresh_pattern configuration directive.