Skip to content

Commit

Permalink
Merge pull request #1070 from stevenpost/fixes/apache_name
Browse files Browse the repository at this point in the history
Fixes/apache name
  • Loading branch information
igalic committed Apr 3, 2015
2 parents dc26c77 + 296aab5 commit 69e0a89
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 21 deletions.
3 changes: 0 additions & 3 deletions manifests/dev.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
class apache::dev {
if $::osfamily == 'FreeBSD' and !defined(Class['apache::package']) {
fail('apache::dev requires apache::package; please include apache or apache::package class first')
}
include ::apache::params
$packages = $::apache::params::dev_packages
if $packages { # FreeBSD doesn't have dev packages to install
Expand Down
10 changes: 8 additions & 2 deletions manifests/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
$ensure = 'present',
$mpm_module = $::apache::params::mpm_module,
) inherits ::apache::params {

# The base class must be included first because it is used by parameter defaults
if ! defined(Class['apache']) {
fail('You must include the apache base class before using any apache defined resources')
}

case $::osfamily {
'FreeBSD': {
case $mpm_module {
Expand Down Expand Up @@ -44,10 +50,10 @@
before => Package['httpd'],
}
}
$apache_package = $::apache::params::apache_name
$apache_package = $::apache::apache_name
}
default: {
$apache_package = $::apache::params::apache_name
$apache_package = $::apache::apache_name
}
}

Expand Down
2 changes: 1 addition & 1 deletion manifests/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
fail('You must include the apache base class before using any apache defined resources')
}

$apache_name = $::apache::params::apache_name
$apache_name = $::apache::apache_name

validate_re($ensure, '^(present|absent)$',
"${ensure} is not supported for ensure.
Expand Down
29 changes: 23 additions & 6 deletions spec/classes/dev_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
require 'spec_helper'

describe 'apache::dev', :type => :class do
let(:pre_condition) {[
'include apache'
]}
context "on a Debian OS" do
let :facts do
{
Expand All @@ -9,6 +12,10 @@
:operatingsystem => 'Debian',
:operatingsystemrelease => '6',
:is_pe => false,
:concat_basedir => '/foo',
:id => 'root',
:path => '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin',
:kernel => 'Linux'
}
end
it { is_expected.to contain_class("apache::params") }
Expand All @@ -25,6 +32,10 @@
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '14.04',
:is_pe => false,
:concat_basedir => '/foo',
:id => 'root',
:path => '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin',
:kernel => 'Linux'
}
end
it { is_expected.to contain_package("apache2-dev") }
Expand All @@ -36,36 +47,42 @@
:operatingsystem => 'RedHat',
:operatingsystemrelease => '6',
:is_pe => false,
:concat_basedir => '/foo',
:id => 'root',
:path => '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin',
:kernel => 'Linux'
}
end
it { is_expected.to contain_class("apache::params") }
it { is_expected.to contain_package("httpd-devel") }
end
context "on a FreeBSD OS" do
let :pre_condition do
'include apache::package'
end
let :facts do
{
:osfamily => 'FreeBSD',
:operatingsystem => 'FreeBSD',
:operatingsystemrelease => '9',
:is_pe => false,
:concat_basedir => '/foo',
:id => 'root',
:path => '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin',
:kernel => 'FreeBSD'
}
end
it { is_expected.to contain_class("apache::params") }
end
context "on a Gentoo OS" do
let :pre_condition do
'include apache::package'
end
let :facts do
{
:osfamily => 'Gentoo',
:operatingsystem => 'Gentoo',
:operatingsystemrelease => '3.16.1-gentoo',
:concat_basedir => '/dne',
:is_pe => false,
:concat_basedir => '/foo',
:id => 'root',
:path => '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin',
:kernel => 'Linux'
}
end
it { is_expected.to contain_class("apache::params") }
Expand Down
20 changes: 11 additions & 9 deletions spec/classes/mod/dev_spec.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
require 'spec_helper'

describe 'apache::mod::dev', :type => :class do
let(:pre_condition) {[
'include apache'
]}
[
['RedHat', '6', 'Santiago'],
['Debian', '6', 'squeeze'],
['FreeBSD', '9', 'FreeBSD'],
].each do |osfamily, operatingsystemrelease, lsbdistcodename|
if osfamily == 'FreeBSD'
let :pre_condition do
'include apache::package'
end
end
['RedHat', '6', 'Santiago', 'Linux'],
['Debian', '6', 'squeeze', 'Linux'],
['FreeBSD', '9', 'FreeBSD', 'FreeBSD'],
].each do |osfamily, operatingsystemrelease, lsbdistcodename, kernel|
context "on a #{osfamily} OS" do
let :facts do
{
Expand All @@ -19,6 +17,10 @@
:operatingsystem => osfamily,
:operatingsystemrelease => operatingsystemrelease,
:is_pe => false,
:concat_basedir => '/foo',
:id => 'root',
:path => '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin',
:kernel => kernel
}
end
it { is_expected.to contain_class('apache::dev') }
Expand Down

0 comments on commit 69e0a89

Please sign in to comment.