-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the option to use an array for extra_config_section
The option "extra_config_section" can be defined as an array, this adds the option to add an option on multiple lines instead of one big line. This commit addresses issue #31
- Loading branch information
Showing
6 changed files
with
69 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,9 +79,9 @@ class{'::squid': | |
'http://example.com/anotherpath'], | ||
}, | ||
}, | ||
http_access => { 'our_networks hosts' => { action => 'allow', }, | ||
http_ports => { '10000' => { options => 'accel vhost'} }, | ||
snmp_ports => { '1000' => { process_number => 3 }, | ||
http_access => { 'our_networks hosts' => { action => 'allow', }}, | ||
http_ports => { '10000' => { options => 'accel vhost', }}, | ||
snmp_ports => { '1000' => { process_number => 3 }}, | ||
cache_dirs => { '/data/' => { type => 'ufs', options => '15000 32 256 min-size=32769', process_number => 2 }}, | ||
} | ||
``` | ||
|
@@ -337,6 +337,30 @@ mail_from [email protected] | |
mail_program mail | ||
``` | ||
|
||
And using an array: | ||
|
||
```puppet | ||
squid::extra_config_section { 'refresh patterns': | ||
order => '60', | ||
config_entries => [{ | ||
'refresh_pattern' => ['^ftp: 1440 20% 10080', | ||
'^gopher: 1440 0% 1440', | ||
'-i (/cgi-bin/|\?) 0 0% 0', | ||
'. 0 20% 4320'], | ||
}], | ||
} | ||
``` | ||
|
||
Results in a squid configuration of | ||
|
||
``` | ||
# refresh_patterns | ||
refresh_pattern ^ftp: 1440 20% 10080 | ||
refresh_pattern ^gopher: 1440 0% 1440 | ||
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 | ||
refresh_pattern . 0 20% 4320 | ||
``` | ||
|
||
#### Parameters for Type squid::extra\_config\_section | ||
* `comment` defaults to the namevar and is used as a section comment in `squid.conf`. | ||
* `config_entries` A hash of configuration entries to create in this section. The hash key is the name of the configuration directive. The value is either a string, or an array of strings to use as the configuration directive options. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
# <%= @comment %> | ||
<% if @config_entries.is_a?(Array) -%> | ||
<% @config_entries.each do |i| -%> | ||
<% i.each do |k, v| -%> | ||
<% v.each do |v2| -%> | ||
<%= k %> <%= v2 %> | ||
<% end -%> | ||
<% end -%> | ||
<% end -%> | ||
<% else -%> | ||
<% @config_entries.each do |k,v| -%> | ||
<%= k %> <%= v.is_a?(Array) ? v.join(' ') : v %> | ||
<% end -%> | ||
<% end -%> | ||
|