Skip to content

Commit

Permalink
Merge pull request #721 from mcanevet/fix/strict_variables
Browse files Browse the repository at this point in the history
Fix module usage with strict_variables
  • Loading branch information
igalic committed Jun 6, 2014
2 parents 024d983 + 240197f commit a6c1fbc
Show file tree
Hide file tree
Showing 41 changed files with 500 additions and 9 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:
- PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0"
- PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
- PUPPET_GEM_VERSION="~> 3.0"
- PUPPET_GEM_VERSION="~> 3.5.0" STRICT_VARIABLES="yes"
matrix:
fast_finish: true
exclude:
Expand Down
2 changes: 2 additions & 0 deletions manifests/mod.pp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
$_package = $package
} elsif $mod_package {
$_package = $mod_package
} else {
$_package = undef
}
if $_package and ! defined(Package[$_package]) {
# note: FreeBSD/ports uses apxs tool to activate modules; apxs clutters
Expand Down
1 change: 1 addition & 0 deletions manifests/mod/proxy_html.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
case $::osfamily {
/RedHat|FreeBSD/: {
::apache::mod { 'xml2enc': }
$loadfiles = undef
}
'Debian': {
$gnu_path = $::hardwaremodel ? {
Expand Down
2 changes: 1 addition & 1 deletion manifests/package.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class apache::package (
$ensure = 'present',
$mpm_module = $::apache::params::mpm_module,
) {
) inherits ::apache::params {
case $::osfamily {
'freebsd' : {
$all_mpms = [
Expand Down
2 changes: 2 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
$conf_dir = "${httpd_dir}/conf"
$confd_dir = "${httpd_dir}/conf.d"
$mod_dir = "${httpd_dir}/conf.d"
$mod_enable_dir = undef
$vhost_dir = "${httpd_dir}/conf.d"
$vhost_enable_dir = undef
$conf_file = 'httpd.conf'
$ports_file = "${conf_dir}/ports.conf"
$logroot = '/var/log/httpd'
Expand Down
2 changes: 2 additions & 0 deletions manifests/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@
$listen_addr_port = "${ip}:${port}"
$nvh_addr_port = "${ip}:${port}"
} else {
$listen_addr_port = undef
$nvh_addr_port = $ip
if ! $servername and ! $ip_based {
fail("Apache::Vhost[${name}]: must pass 'ip' and/or 'port' parameters for name-based vhosts")
Expand All @@ -337,6 +338,7 @@
$listen_addr_port = $port
$nvh_addr_port = "${vhost_name}:${port}"
} else {
$listen_addr_port = undef
$nvh_addr_port = $name
if ! $servername {
fail("Apache::Vhost[${name}]: must pass 'ip' and/or 'port' parameters, and/or 'servername' parameter")
Expand Down
20 changes: 20 additions & 0 deletions spec/classes/apache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
context "on a Debian OS" do
let :facts do
{
:id => 'root',
:kernel => 'Linux',
:lsbdistcodename => 'squeeze',
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '6',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:concat_basedir => '/dne',
}
end
Expand Down Expand Up @@ -165,6 +170,7 @@
context "13.10" do
let :facts do
super().merge({
:lsbdistrelease => '13.10',
:operatingsystemrelease => '13.10'
})
end
Expand All @@ -173,6 +179,7 @@
context "12.04" do
let :facts do
super().merge({
:lsbdistrelease => '12.04',
:operatingsystemrelease => '12.04'
})
end
Expand All @@ -181,6 +188,7 @@
context "13.04" do
let :facts do
super().merge({
:lsbdistrelease => '13.04',
:operatingsystemrelease => '13.04'
})
end
Expand All @@ -191,9 +199,13 @@
context "on a RedHat 5 OS" do
let :facts do
{
:id => 'root',
:kernel => 'Linux',
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '5',
:concat_basedir => '/dne',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
it { should contain_class("apache::params") }
Expand Down Expand Up @@ -444,9 +456,13 @@
context "on a FreeBSD OS" do
let :facts do
{
:id => 'root',
:kernel => 'FreeBSD',
:osfamily => 'FreeBSD',
:operatingsystem => 'FreeBSD',
:operatingsystemrelease => '9',
:concat_basedir => '/dne',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
it { should contain_class("apache::params") }
Expand Down Expand Up @@ -516,9 +532,13 @@
context 'on all OSes' do
let :facts do
{
:id => 'root',
:kernel => 'Linux',
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '6',
:concat_basedir => '/dne',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
context 'default vhost defaults' do
Expand Down
4 changes: 4 additions & 0 deletions spec/classes/dev_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
context "on a Debian OS" do
let :facts do
{
:lsbdistcodename => 'squeeze',
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '6',
}
end
Expand All @@ -17,6 +19,7 @@
let :facts do
{
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '6',
}
end
Expand All @@ -30,6 +33,7 @@
let :facts do
{
:osfamily => 'FreeBSD',
:operatingsystem => 'FreeBSD',
:operatingsystemrelease => '9',
}
end
Expand Down
15 changes: 15 additions & 0 deletions spec/classes/mod/auth_kerb_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
require 'spec_helper'

describe 'apache::mod::auth_kerb', :type => :class do
let :pre_condition do
'include apache'
end
context "on a Debian OS", :compile do
let :facts do
{
:id => 'root',
:kernel => 'Linux',
:lsbdistcodename => 'squeeze',
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '6',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:concat_basedir => '/dne',
}
end
Expand All @@ -17,8 +24,12 @@
context "on a RedHat OS", :compile do
let :facts do
{
:id => 'root',
:kernel => 'Linux',
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '6',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:concat_basedir => '/dne',
}
end
Expand All @@ -29,8 +40,12 @@
context "on a FreeBSD OS", :compile do
let :facts do
{
:id => 'root',
:kernel => 'FreeBSD',
:osfamily => 'FreeBSD',
:operatingsystem => 'FreeBSD',
:operatingsystemrelease => '9',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:concat_basedir => '/dne',
}
end
Expand Down
11 changes: 11 additions & 0 deletions spec/classes/mod/authnz_ldap_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'spec_helper'

describe 'apache::mod::authnz_ldap', :type => :class do
let :pre_condition do
'include apache'
Expand All @@ -6,9 +8,14 @@
context "on a Debian OS" do
let :facts do
{
:lsbdistcodename => 'squeeze',
:osfamily => 'Debian',
:operatingsystemrelease => '6',
:concat_basedir => '/dne',
:id => 'root',
:kernel => 'Linux',
:operatingsystem => 'Debian',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
it { should contain_class("apache::params") }
Expand Down Expand Up @@ -38,6 +45,10 @@
:osfamily => 'RedHat',
:operatingsystemrelease => '6',
:concat_basedir => '/dne',
:id => 'root',
:kernel => 'Linux',
:operatingsystem => 'RedHat',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
it { should contain_class("apache::params") }
Expand Down
15 changes: 15 additions & 0 deletions spec/classes/mod/dav_svn_spec.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
require 'spec_helper'

describe 'apache::mod::dav_svn', :type => :class do
let :pre_condition do
'include apache'
end
context "on a Debian OS" do
let :facts do
{
:lsbdistcodename => 'squeeze',
:osfamily => 'Debian',
:operatingsystemrelease => '6',
:concat_basedir => '/dne',
:operatingsystem => 'Debian',
:id => 'root',
:kernel => 'Linux',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
it { should contain_class("apache::params") }
Expand All @@ -20,6 +27,10 @@
:osfamily => 'RedHat',
:operatingsystemrelease => '6',
:concat_basedir => '/dne',
:operatingsystem => 'RedHat',
:id => 'root',
:kernel => 'Linux',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
it { should contain_class("apache::params") }
Expand All @@ -32,6 +43,10 @@
:osfamily => 'FreeBSD',
:operatingsystemrelease => '9',
:concat_basedir => '/dne',
:operatingsystem => 'FreeBSD',
:id => 'root',
:kernel => 'Linux',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
it { should contain_class("apache::params") }
Expand Down
12 changes: 12 additions & 0 deletions spec/classes/mod/deflate_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'spec_helper'

# This function is called inside the OS specific contexts
def general_deflate_specs
it { should contain_apache__mod("deflate") }
Expand All @@ -24,8 +26,12 @@ def general_deflate_specs
context "On a Debian OS with default params" do
let :facts do
{
:id => 'root',
:lsbdistcodename => 'squeeze',
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '6',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:concat_basedir => '/dne',
}
end
Expand All @@ -46,8 +52,11 @@ def general_deflate_specs
context "on a RedHat OS with default params" do
let :facts do
{
:id => 'root',
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '6',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:concat_basedir => '/dne',
}
end
Expand All @@ -61,8 +70,11 @@ def general_deflate_specs
context "On a FreeBSD OS with default params" do
let :facts do
{
:id => 'root',
:osfamily => 'FreeBSD',
:operatingsystem => 'FreeBSD',
:operatingsystemrelease => '9',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:concat_basedir => '/dne',
}
end
Expand Down
11 changes: 7 additions & 4 deletions spec/classes/mod/dev_spec.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
require 'spec_helper'

describe 'apache::mod::dev', :type => :class do
[
['RedHat', '6'],
['Debian', '6'],
['FreeBSD', '9'],
].each do |osfamily, operatingsystemrelease|
['RedHat', '6', 'Santiago'],
['Debian', '6', 'squeeze'],
['FreeBSD', '9', 'FreeBSD'],
].each do |osfamily, operatingsystemrelease, lsbdistcodename|
if osfamily == 'FreeBSD'
let :pre_condition do
'include apache::package'
Expand All @@ -13,7 +14,9 @@
context "on a #{osfamily} OS" do
let :facts do
{
:lsbdistcodename => lsbdistcodename,
:osfamily => osfamily,
:operatingsystem => osfamily,
:operatingsystemrelease => operatingsystemrelease,
}
end
Expand Down
15 changes: 15 additions & 0 deletions spec/classes/mod/dir_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'spec_helper'

describe 'apache::mod::dir', :type => :class do
let :pre_condition do
'class { "apache":
Expand All @@ -10,6 +12,11 @@
:osfamily => 'Debian',
:operatingsystemrelease => '6',
:concat_basedir => '/dne',
:operatingsystem => 'Debian',
:id => 'root',
:kernel => 'Linux',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:lsbdistcodename => 'squeeze',
}
end
context "passing no parameters" do
Expand Down Expand Up @@ -37,6 +44,10 @@
:osfamily => 'RedHat',
:operatingsystemrelease => '6',
:concat_basedir => '/dne',
:operatingsystem => 'Redhat',
:id => 'root',
:kernel => 'Linux',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
context "passing no parameters" do
Expand Down Expand Up @@ -64,6 +75,10 @@
:osfamily => 'FreeBSD',
:operatingsystemrelease => '9',
:concat_basedir => '/dne',
:operatingsystem => 'FreeBSD',
:id => 'root',
:kernel => 'FreeBSD',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
context "passing no parameters" do
Expand Down
Loading

0 comments on commit a6c1fbc

Please sign in to comment.