Skip to content

Commit

Permalink
Fix variable names, convert flags to bool and use bool2httpd function
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-mueller committed Mar 23, 2015
1 parent 43c5c5e commit fefaa40
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -635,14 +635,14 @@ These are the default settings:

```puppet
class {'apache::mod::geoip':
$enable => 'Off',
$dbfile => '/usr/share/GeoIP/GeoIP.dat',
$flag => 'Standard',
$output => 'All',
$enable => false,
$db_file => '/usr/share/GeoIP/GeoIP.dat',
$flag => 'Standard',
$output => 'All',
}
```

The parameter `dbfile` can be a single directory or a hash of directories.
The parameter `db_file` can be a single directory or a hash of directories.

####Class: `apache::mod::info`

Expand Down Expand Up @@ -1859,7 +1859,7 @@ Note that you must declare `class {'apache::mod::geoip': }` before using this di
docroot => '/var/www/first',
directories => [
{ path => '/var/www/first',
geoip_enable => 'On',
geoip_enable => true,
},
],
}
Expand Down
22 changes: 11 additions & 11 deletions manifests/mod/geoip.pp
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
class apache::mod::geoip (
$enable = 'Off',
$dbfile = '/usr/share/GeoIP/GeoIP.dat',
$flag = 'Standard',
$output = 'All',
$enableutf8 = undef,
$scanproxyheaders = undef,
$uselastxforwarededforip = undef,
$enable = false,
$db_file = '/usr/share/GeoIP/GeoIP.dat',
$flag = 'Standard',
$output = 'All',
$enable_utf8 = undef,
$scan_proxy_headers = undef,
$use_last_xforwarededfor_ip = undef,
) {
::apache::mod { 'geoip': }

# Template uses:
# - enable
# - dbfile
# - db_file
# - flag
# - output
# - enableutf8
# - scanproxyheaders
# - uselastxforwarededforip
# - enable_utf8
# - scan_proxy_headers
# - use_last_xforwarededfor_ip
file { 'geoip.conf':
ensure => file,
path => "${::apache::mod_dir}/geoip.conf",
Expand Down
22 changes: 11 additions & 11 deletions templates/mod/geoip.conf.erb
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
GeoIPEnable <%= @enable %>
GeoIPEnable <%= scope.function_bool2httpd([@enable]) %>
<%- if @dbfile and ! [ false, 'false', '' ].include?(@dbfile) -%>
<%- if @dbfile.kind_of?(Array) -%>
<%- Array(@dbfile).each do |file| -%>
<%- if @db_file and ! [ false, 'false', '' ].include?(@db_file) -%>
<%- if @db_file.kind_of?(Array) -%>
<%- Array(@db_file).each do |file| -%>
GeoIPDBFile <%= file %> <%= @flag %>
<%- end -%>
<%- else -%>
GeoIPDBFile <%= @dbfile %> <%= @flag %>
GeoIPDBFile <%= @db_file %> <%= @flag %>
<%- end -%>
<%- end -%>
GeoIPOutput <%= @output %>
<% if @enableutf8 -%>
GeoIPEnableUTF8 <%= @enableutf8 %>
<% if ! @enable_utf8.nil? -%>
GeoIPEnableUTF8 <%= scope.function_bool2httpd([@enable_utf8]) %>
<% end -%>
<% if @scanproxyheaders -%>
GeoIPScanProxyHeaders <%= @scanproxyheaders %>
<% if ! @scan_proxy_headers.nil? -%>
GeoIPScanProxyHeaders <%= scope.function_bool2httpd([@scan_proxy_headers]) %>
<% end -%>
<% if @uselastxforwarededforip -%>
GeoIPUseLastXForwardedForIP <%= @uselastxforwarededforip %>
<% if ! @use_last_xforwarededfor_ip.nil? -%>
GeoIPUseLastXForwardedForIP <%= scope.function_bool2httpd([@use_last_xforwarededfor_ip]) %>
<% end -%>

4 changes: 2 additions & 2 deletions templates/vhost/_directories.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
Header <%= header %>
<%- end -%>
<%- end -%>
<%- if directory['geoip_enable'] and directory['geoip_enable'] != '' -%>
GeoIPEnable <%= directory['geoip_enable'] %>
<%- if ! directory['geoip_enable'].nil? -%>
GeoIPEnable <%= scope.function_bool2httpd([directory['geoip_enable']]) %>
<%- end -%>
<%- if directory['options'] -%>
Options <%= Array(directory['options']).join(' ') %>
Expand Down

0 comments on commit fefaa40

Please sign in to comment.