-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91e4e18
commit e988753
Showing
4 changed files
with
83 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,37 @@ | |||
# | |||
# Cookbook:: . | |||
# Recipe:: lamp | |||
# | |||
# Copyright:: 2021, The Authors, All Rights Reserved. | |||
|
|||
package_name = nil | |||
php_packages = nil | |||
if node['platform'] == 'ubuntu' | |||
apt_update 'update ubuntu packages' do | |||
ignore_failure true | |||
action :update | |||
end | |||
package_name = 'apache2' | |||
php_packages = %w(php libapache2-mod-php php-mysql php-cli) | |||
|
|||
elsif node['platform'] == 'centos' | |||
package_name = 'httpd' | |||
php_packages = %w(php php-mysql php-fpm) | |||
|
|||
else | |||
raise 'this cookbook is developed only for centos and ubuntu' | |||
end | |||
|
|||
package package_name do | |||
action :install | |||
end | |||
|
|||
php_packages.each do |php_package| | |||
package php_package do | |||
action :install | |||
end | |||
end | |||
|
|||
service package_name do | |||
action :restart | |||
end |
29 changes: 29 additions & 0 deletions
29
Jan21/cookbooks/qtlampserver/spec/unit/recipes/lamp_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,29 @@ | |||
# | |||
# Cookbook:: . | |||
# Spec:: lamp | |||
# | |||
# Copyright:: 2021, The Authors, All Rights Reserved. | |||
|
|||
require 'spec_helper' | |||
|
|||
describe '.::lamp' 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 |
16 changes: 16 additions & 0 deletions
16
Jan21/cookbooks/qtlampserver/test/integration/default/lamp_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
# InSpec test for recipe .::lamp | |||
|
|||
# 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 |