Skip to content
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

fix for log_dir not being honored (#895) #904

Merged
merged 1 commit into from
Oct 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
$global_group = $::nginx::params::global_group,
$global_mode = $::nginx::params::global_mode,
$log_dir = $::nginx::params::log_dir,
$http_access_log = $::nginx::params::http_access_log,
$http_access_log = "${log_dir}/${::nginx::params::http_access_log_file}",
$http_format_log = undef,
$nginx_error_log = $::nginx::params::nginx_error_log,
$nginx_error_log = "${log_dir}/${::nginx::params::nginx_error_log_file}",
$nginx_error_log_severity = 'error',
$pid = $::nginx::params::pid,
$proxy_temp_path = $::nginx::params::proxy_temp_path,
Expand Down
4 changes: 2 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@
$global_owner = 'root'
$global_group = $_module_parameters['root_group']
$global_mode = '0644'
$http_access_log = "${log_dir}/access.log"
$http_access_log_file = 'access.log'
$manage_repo = $_module_parameters['manage_repo']
$nginx_error_log = "${log_dir}/error.log"
$nginx_error_log_file = 'error.log'
$root_group = $_module_parameters['root_group']
$package_name = $_module_parameters['package_name']
$proxy_temp_path = "${run_dir}/proxy_temp"
Expand Down
16 changes: 16 additions & 0 deletions spec/classes/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -691,5 +691,21 @@

it { expect { is_expected.to contain_class('nginx::config') }.to raise_error(Puppet::Error, %r{\$nginx_error_log_severity must be debug, info, notice, warn, error, crit, alert or emerg}) }
end

context 'when log_dir is non-default' do
let(:params) { { log_dir: '/foo/bar' } }

it { is_expected.to contain_file('/foo/bar').with(ensure: 'directory') }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add tests for the $http_access_log and $nginx_error_log variables as well? not sure if they contain the correct path.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How's that look?

it do
is_expected.to contain_file('/etc/nginx/nginx.conf').with_content(
%r{access_log /foo/bar/access.log;}
)
end
it do
is_expected.to contain_file('/etc/nginx/nginx.conf').with_content(
%r{error_log /foo/bar/error.log error;}
)
end
end
end
end