Skip to content

Commit

Permalink
fix for #802: when !manage_docroot, don't require it
Browse files Browse the repository at this point in the history
in #802 we introduced manage_docroot, however, I overlooked a place in
the code were we `require` it. This patch moves the priority_real, and
filename evaluation above, so we can simply use a `before`.

Perhaps we should cluster all variable transformation right below the
validation code?
  • Loading branch information
igalic committed Aug 8, 2014
1 parent a11908f commit 935ee10
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions manifests/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,18 @@
include ::apache::mod::suexec
}

# Configure the defaultness of a vhost
if $priority {
$priority_real = $priority
} elsif $default_vhost {
$priority_real = '10'
} else {
$priority_real = '25'
}

## Apache include does not always work with spaces in the filename
$filename = regsubst($name, ' ', '_', 'G')

# This ensures that the docroot exists
# But enables it to be specified across multiple vhost resources
if ! defined(File[$docroot]) and $manage_docroot {
Expand All @@ -273,6 +285,7 @@
group => $docroot_group,
mode => $docroot_mode,
require => Package['httpd'],
before => File["${priority_real}-${filename}.conf"],
}
}

Expand Down Expand Up @@ -404,25 +417,13 @@
}
}

# Configure the defaultness of a vhost
if $priority {
$priority_real = $priority
} elsif $default_vhost {
$priority_real = '10'
} else {
$priority_real = '25'
}

# Check if mod_headers is required to process $headers/$request_headers
if $headers or $request_headers {
if ! defined(Class['apache::mod::headers']) {
include ::apache::mod::headers
}
}

## Apache include does not always work with spaces in the filename
$filename = regsubst($name, ' ', '_', 'G')

## Create a default directory list if none defined
if $directories {
if !is_hash($directories) and !(is_array($directories) and is_hash($directories[0])) {
Expand Down Expand Up @@ -542,7 +543,6 @@
mode => '0644',
require => [
Package['httpd'],
File[$docroot],
File[$logroot],
],
notify => Service['httpd'],
Expand Down

0 comments on commit 935ee10

Please sign in to comment.