set required variables before template declared

correctly sets www_root in the vhost_header template
This commit is contained in:
Matthew Haughton 2013-11-21 23:23:45 -05:00
parent 43d628d4f0
commit 8292be0748
2 changed files with 19 additions and 19 deletions

View file

@ -181,19 +181,6 @@ define nginx::resource::vhost (
default => $error_log,
}
# Use the File Fragment Pattern to construct the configuration files.
# Create the base configuration file reference.
if ($listen_port != $ssl_port) {
file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-001":
ensure => $ensure ? {
'absent' => absent,
default => 'file',
},
content => template('nginx/vhost/vhost_header.erb'),
notify => Class['nginx::service'],
}
}
if ($ssl == true) and ($ssl_port == $listen_port) {
$ssl_only = true
}
@ -244,6 +231,19 @@ define nginx::resource::vhost (
}
}
# Use the File Fragment Pattern to construct the configuration files.
# Create the base configuration file reference.
if ($listen_port != $ssl_port) {
file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-001":
ensure => $ensure ? {
'absent' => absent,
default => 'file',
},
content => template('nginx/vhost/vhost_header.erb'),
notify => Class['nginx::service'],
}
}
# Create a proper file close stub.
if ($listen_port != $ssl_port) {
file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-699": content => template('nginx/vhost/vhost_footer.erb'), }

View file

@ -134,12 +134,12 @@ describe 'nginx::resource::vhost' do
' test2 test value 2;',
],
},
#{
# :title => 'should set root',
# :attr => 'use_default_location',
# :value => false,
# :match => ' root /;',
#},
{
:title => 'should set root',
:attr => 'use_default_location',
:value => false,
:match => ' root /;',
},
{
:title => 'should not set root',
:attr => 'use_default_location',