mirror of
https://github.com/inspec/inspec
synced 2024-11-27 23:20:33 +00:00
Merge pull request #407 from chef/chris-rock/apache
Improve apache resource
This commit is contained in:
commit
88705af495
5 changed files with 51 additions and 3 deletions
|
@ -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|
|
||||
|
|
|
@ -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'
|
||||
|
|
14
test/integration/cookbooks/os_prepare/recipes/apache.rb
Normal file
14
test/integration/cookbooks/os_prepare/recipes/apache.rb
Normal 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
|
|
@ -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')
|
||||
|
|
|
@ -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
|
Loading…
Reference in a new issue