Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added info.php in a different recipe to avoid copy paste
  • Loading branch information
directdevops committed Jan 21, 2021
1 parent 3bb4eb8 commit a22ef14
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 20 deletions.
4 changes: 3 additions & 1 deletion Jan21/cookbooks/qtlampserver/recipes/default.rb
Expand Up @@ -10,4 +10,6 @@


if node['platform'] == 'ubuntu' if node['platform'] == 'ubuntu'
include_recipe 'qtlampserver::lamp_ubuntu' include_recipe 'qtlampserver::lamp_ubuntu'
end end

include_recipe 'qtlampserver::phppage'
12 changes: 0 additions & 12 deletions Jan21/cookbooks/qtlampserver/recipes/lamp_centos.rb
Expand Up @@ -27,15 +27,3 @@
yum_package 'php-fpm' do yum_package 'php-fpm' do
action :install action :install
end end


file '/var/www/html/info.php' do
content '<?php phpinfo(); ?>'
action :create
end






7 changes: 0 additions & 7 deletions Jan21/cookbooks/qtlampserver/recipes/lamp_ubuntu.rb
Expand Up @@ -39,10 +39,3 @@
service 'apache2' do service 'apache2' do
action :restart action :restart
end end

file '/var/www/html/info.php' do
content '<?php phpinfo(); ?>'
action :create
end


11 changes: 11 additions & 0 deletions Jan21/cookbooks/qtlampserver/recipes/phppage.rb
@@ -0,0 +1,11 @@
#
# Cookbook:: .
# Recipe:: phppage
#
# Copyright:: 2021, The Authors, All Rights Reserved.

# Create a info.php page
file '/var/www/html/info.php' do
content '<?php phpinfo(); ?>'
action :create
end
29 changes: 29 additions & 0 deletions Jan21/cookbooks/qtlampserver/spec/unit/recipes/phppage_spec.rb
@@ -0,0 +1,29 @@
#
# Cookbook:: .
# Spec:: phppage
#
# Copyright:: 2021, The Authors, All Rights Reserved.

require 'spec_helper'

describe '.::phppage' do
context 'When all attributes are default, on Ubuntu 18.04' do
# for a complete list of available platforms and versions see:
# https://github.com/chefspec/fauxhai/blob/master/PLATFORMS.md
platform 'ubuntu', '18.04'

it 'converges successfully' do
expect { chef_run }.to_not raise_error
end
end

context 'When all attributes are default, on CentOS 7' do
# for a complete list of available platforms and versions see:
# https://github.com/chefspec/fauxhai/blob/master/PLATFORMS.md
platform 'centos', '7'

it 'converges successfully' do
expect { chef_run }.to_not raise_error
end
end
end
@@ -0,0 +1,16 @@
# InSpec test for recipe .::phppage

# The InSpec reference, with examples and extensive documentation, can be
# found at https://www.inspec.io/docs/reference/resources/

unless os.windows?
# This is an example test, replace with your own test.
describe user('root'), :skip do
it { should exist }
end
end

# This is an example test, replace it with your own test.
describe port(80), :skip do
it { should_not be_listening }
end

0 comments on commit a22ef14

Please sign in to comment.