Merge pull request #407 from chef/chris-rock/apache

Improve apache resource
This commit is contained in:
Dominik Richter 2016-02-09 17:49:50 +01:00
commit 88705af495
5 changed files with 51 additions and 3 deletions

View file

@ -40,6 +40,14 @@ class ApacheConf < Inspec.resource(1)
res
end
def method_missing(name)
# ensure params are loaded
@params || read_content
# extract values
@params[name.to_s] unless @params.nil?
end
def filter_comments(data)
content = ''
data.each_line do |line|

View file

@ -4,7 +4,9 @@ maintainer 'Chef Software, Inc.'
maintainer_email 'support@chef.io'
description 'This cookbook prepares the test operating systems'
version '1.0.0'
depends 'apt'
depends 'yum'
depends 'runit'
depends 'postgresql'
depends 'httpd', '~> 0.2'

View file

@ -0,0 +1,14 @@
# encoding: utf-8
# author: Christoph Hartmann
# install apache service
case node['platform']
when 'ubuntu', 'centos', 'amazon', 'fedora'
return if node['platform_version'] == "15.10"
httpd_service 'default' do
action :create
end
end

View file

@ -4,12 +4,21 @@
#
# prepare all operating systems with the required configuration
include_recipe('os_prepare::apt')
# basic tests
include_recipe('os_prepare::file')
include_recipe('os_prepare::mount')
include_recipe('os_prepare::json_yaml_csv_ini')
include_recipe('os_prepare::service')
include_recipe('os_prepare::package')
include_recipe('os_prepare::registry_key')
include_recipe('os_prepare::service')
# configure repos, eg. nginx
include_recipe('os_prepare::apt')
# application configuration
include_recipe('os_prepare::postgres')
include_recipe('os_prepare::auditctl')
include_recipe('os_prepare::apache')
# config file parsing
include_recipe('os_prepare::json_yaml_csv_ini')

View file

@ -0,0 +1,15 @@
# encoding: utf-8
if os.linux?
# direct access to params of apache conf
describe apache_conf do
its('LogLevel') { should eq 'warn' }
its('MaxKeepAliveRequests') { should eq '100' }
end
# only read one param
describe apache_conf.params('LogLevel') do
it { should include 'warn' }
end
end