Skip to content

Commit

Permalink
Merge pull request #44 from zoide/ssl-fixes
Browse files Browse the repository at this point in the history
more boolean comparison fixes
  • Loading branch information
James Fryman committed Apr 13, 2013
2 parents 108c5b8 + 564e9c3 commit b6d6f5f
Showing 1 changed file with 16 additions and 39 deletions.
55 changes: 16 additions & 39 deletions manifests/resource/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,24 @@
$location_cfg_append = undef,
$try_files = undef) {
File {
owner => 'root',
group => 'root',
mode => '0644',
ensure => $ensure ? {
'absent' => absent,
default => 'file',
},
notify => Class['nginx::service'],
owner => 'root',
group => 'root',
mode => '0644',
}

# Add IPv6 Logic Check - Nginx service will not start if ipv6 is enabled
# and support does not exist for it in the kernel.
if ($ipv6_enable == 'true') and ($ipaddress6) {
if ($ipv6_enable == true) and ($ipaddress6) {
warning('nginx: IPv6 support is not enabled or configured properly')
}

# Check to see if SSL Certificates are properly defined.
if ($ssl == 'true') {
if ($ssl == true) {
if ($ssl_cert == undef) or ($ssl_key == undef) {
fail('nginx: SSL certificate/key (ssl_cert/ssl_cert) and/or SSL Private must be defined and exist on the target system(s)')
}
Expand All @@ -86,18 +91,11 @@
# 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'],
}
file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-001": content => template('nginx/vhost/vhost_header.erb'), }
}

if ($ssl == 'true') and ($ssl_port == $listen_port) {
$ssl_only = 'true'
if ($ssl == true) and ($ssl_port == $listen_port) {
$ssl_only = true
}

# Create the default location reference for the vHost
Expand Down Expand Up @@ -127,34 +125,13 @@

# Create a proper file close stub.
if ($listen_port != $ssl_port) {
file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-699":
ensure => $ensure ? {
'absent' => absent,
default => 'file',
},
content => template('nginx/vhost/vhost_footer.erb'),
notify => Class['nginx::service'],
}
file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-699": content => template('nginx/vhost/vhost_footer.erb'), }
}

# Create SSL File Stubs if SSL is enabled
if ($ssl) {
file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-700-ssl":
ensure => $ensure ? {
'absent' => absent,
default => 'file',
},
content => template('nginx/vhost/vhost_ssl_header.erb'),
notify => Class['nginx::service'],
}
file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-700-ssl": content => template('nginx/vhost/vhost_ssl_header.erb'), }

file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-999-ssl":
ensure => $ensure ? {
'absent' => absent,
default => 'file',
},
content => template('nginx/vhost/vhost_footer.erb'),
notify => Class['nginx::service'],
}
file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-999-ssl": content => template('nginx/vhost/vhost_footer.erb'), }
}
}

0 comments on commit b6d6f5f

Please sign in to comment.