bug fixes surfaced by future parser

* concat::fragment requires 'order' to be a string
* init parameters added in #373 referred to wrong variable name in params.pp
* cannot perform regex match on a number, so make {fastcgi,proxy}_cache_levels
  a string by default
* bug fixed in test suite
This commit is contained in:
Matthew Haughton 2014-09-04 23:24:14 -04:00
parent c3d1149da9
commit a002d8932e
4 changed files with 21 additions and 13 deletions

View file

@ -96,12 +96,12 @@ class nginx (
$worker_connections = $nginx::params::nx_worker_connections,
$worker_processes = $nginx::params::nx_worker_processes,
$worker_rlimit_nofile = $nginx::params::nx_worker_rlimit_nofile,
$global_owner = $nginx::params::nx_global_owner,
$global_group = $nginx::params::nx_global_group,
$global_mode = $nginx::params::nx_global_mode,
$sites_available_owner = $nginx::params::nx_sites_available_owner,
$sites_available_group = $nginx::params::nx_sites_available_group,
$sites_available_mode = $nginx::params::nx_sites_available_mode,
$global_owner = $nginx::params::global_owner,
$global_group = $nginx::params::global_group,
$global_mode = $nginx::params::global_mode,
$sites_available_owner = $nginx::params::sites_available_owner,
$sites_available_group = $nginx::params::sites_available_group,
$sites_available_mode = $nginx::params::sites_available_mode,
$geo_mappings = {},
$string_mappings = {},
) inherits nginx::params {

View file

@ -49,13 +49,13 @@ class nginx::params {
'X-Forwarded-For $proxy_add_x_forwarded_for',
]
$nx_proxy_cache_path = false
$nx_proxy_cache_levels = 1
$nx_proxy_cache_levels = '1'
$nx_proxy_cache_keys_zone = 'd2:100m'
$nx_proxy_cache_max_size = '500m'
$nx_proxy_cache_inactive = '20m'
$nx_fastcgi_cache_path = false
$nx_fastcgi_cache_levels = 1
$nx_fastcgi_cache_levels = '1'
$nx_fastcgi_cache_keys_zone = 'd3:100m'
$nx_fastcgi_cache_max_size = '500m'
$nx_fastcgi_cache_inactive = '20m'

View file

@ -76,7 +76,7 @@ define nginx::resource::upstream (
# Uses: $name, $upstream_cfg_prepend
concat::fragment { "${name}_upstream_header":
target => "${nginx::config::conf_dir}/conf.d/${name}-upstream.conf",
order => 10,
order => '10',
content => template('nginx/conf.d/upstream_header.erb'),
}
@ -84,7 +84,7 @@ define nginx::resource::upstream (
# Uses: $members, $upstream_fail_timeout
concat::fragment { "${name}_upstream_members":
target => "${nginx::config::conf_dir}/conf.d/${name}-upstream.conf",
order => 50,
order => '50',
content => template('nginx/conf.d/upstream_members.erb'),
}
} else {
@ -94,7 +94,7 @@ define nginx::resource::upstream (
concat::fragment { "${name}_upstream_footer":
target => "${nginx::config::conf_dir}/conf.d/${name}-upstream.conf",
order => 90,
order => '90',
content => "}\n",
}
}

View file

@ -26,11 +26,19 @@ describe 'nginx::service' do
end
describe "when configtest_enable => true" do
let(:params) {{ :configtest_enable => true, :service_restart => '/etc/init.d/nginx configtest && /etc/init.d/nginx restart'}}
let :params do {
:configtest_enable => true,
:service_restart => '/etc/init.d/nginx configtest && /etc/init.d/nginx restart',
:service_ensure => 'running',
} end
it { is_expected.to contain_service('nginx').with_restart('/etc/init.d/nginx configtest && /etc/init.d/nginx restart') }
context "when service_restart => 'a restart command'" do
let(:params) {{ :configtest_enable => true, :service_restart => 'a restart command' }}
let :params do {
:configtest_enable => true,
:service_restart => 'a restart command',
:service_ensure => 'running',
} end
it { is_expected.to contain_service('nginx').with_restart('a restart command') }
end
end