Skip to content

Commit

Permalink
mod info arguments type consistency with mod-status (#625)
Browse files Browse the repository at this point in the history
* Allow array syntax for mod-info's allow-list like mod-status

* Auto-convert the property to an Array when it's a type String

* Add a CHANGELOG entry, and also add the 'string-way' to mod_status
  • Loading branch information
Benoit Plessis authored and damacus committed May 20, 2019
1 parent 52d989d commit 2a17e18
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -9,6 +9,7 @@ This file is used to list changes made in each version of the apache2 cookbook.
- Allow users to set / alter the default module list
- Allow users to alter the default modules configuration without rewrites
- Allow users to alter the mpm configuration without rewrites
- Uniform way to pass IP's in mod_info and mod_status

## 7.0.0 (05-03-2019)

Expand Down
6 changes: 3 additions & 3 deletions resources/mod_info.rb
@@ -1,12 +1,12 @@
property :info_allow_list, String,
default: '127.0.0.1 ::1',
property :info_allow_list, [String, Array],
default: %w(127.0.0.1 ::1),
description: ''

action :create do
template ::File.join(apache_dir, 'mods-available', 'info.conf') do
source 'mods/info.conf.erb'
cookbook 'apache2'
variables(info_allow_list: new_resource.info_allow_list)
variables(info_allow_list: Array(new_resource.info_allow_list))
end
end

Expand Down
4 changes: 2 additions & 2 deletions resources/mod_status.rb
Expand Up @@ -2,7 +2,7 @@
default: '/server-status',
description: ''

property :status_allow_list, Array,
property :status_allow_list, [String, Array],
default: %w(127.0.0.1 ::1),
description: 'Clients in the specified IP address ranges can access the resource.
For full description see https://httpd.apache.org/docs/2.4/mod/mod_authz_core.html#require'
Expand All @@ -23,7 +23,7 @@
cookbook 'apache2'
variables(
location: new_resource.location,
status_allow_list: new_resource.status_allow_list,
status_allow_list: Array(new_resource.status_allow_list),
extended_status: new_resource.extended_status,
proxy_status: new_resource.proxy_status
)
Expand Down
2 changes: 1 addition & 1 deletion templates/mods/info.conf.erb
Expand Up @@ -2,6 +2,6 @@
<Location /server-info>
SetHandler server-info
Require local
Require ip <%= @info_allow_list %>
Require ip <%= @info_allow_list.join(' ') %>
</Location>
</IfModule>

0 comments on commit 2a17e18

Please sign in to comment.